Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow option to disable the 'npm ls' command being triggered in the background during JFrog CLI run ( NPM ) #1555

Open
VigneshC-Jfrog opened this issue Jun 2, 2022 · 4 comments
Labels
feature request New feature or request

Comments

@VigneshC-Jfrog
Copy link

Is your feature request related to a problem? Please describe.

While triggering the NPM install command via JFrog CLI in Jenkins, it internally calls the "npm ls" command which would show warning messages related to discrepancies within the dependencies defined in the package.json ( if any ). Attaching the sample snippet and warning messages for reference:

Snippet:

sh('#!/bin/sh -e\n' + "jfrog rt c art-server --url=<artifactory-url> --user=${USERNAME} --password=${PASSWORD}")

sh "jfrog rt use art-server"

sh "jfrog rt npmc --server-id-resolve='art-server' --server-id-deploy='art-server' --repo-resolve='npm-repo' --repo-deploy='npm-repo'"

sh "jfrog rt npm-install --no-shrinkwrap --build-name=${BUILD_NAME} --build-number=${BUILD_NUMBER}"

JFrog CLI logs:

[Warn] npm list command failed with error: exit status 1
[Warn] Some errors occurred while collecting dependencies info:
npm ERR! peer dep missing: ajv@^6.9.1, required by [[email protected]](mailto:[email protected])
npm ERR! peer dep missing: ajv@^6.9.1, required by [[email protected]](mailto:[email protected])
npm ERR! peer dep missing: ajv@^6.9.1, required by [[email protected]](mailto:[email protected])

[Warn] npm dependencies list contains the package 'ajv' without version information. The dependency will not be added to build-info.
[Warn] npm dependencies list contains the package 'ajv' without version information. The dependency will not be added to build-info.
[Warn] npm dependencies list contains the package 'ajv' without version information. The dependency will not be added to build-info.
[Warn] npm list command failed with error: exit status 1
[Warn] Some errors occurred while collecting dependencies info:
npm ERR! peer dep missing: @angular/common@^12.0.0, required by @angular-material-components/[[email protected]](mailto:[email protected])
npm ERR! peer dep missing: @angular/common@^9.0.0, required by [[email protected]](mailto:[email protected])
npm ERR! peer dep missing: @angular/compiler@>=2.3.1 <13.0.0 || ^12.0.0-next || ^12.1.0-next || ^12.2.0-next, required by [[email protected]](mailto:[email protected])
npm ERR! peer dep missing: @angular/core@^12.0.0, required by @angular-material-components/[[email protected]](mailto:[email protected])
npm ERR! peer dep missing: @angular/core@^9.0.0, required by [[email protected]](mailto:[email protected])
npm ERR! peer dep missing: @angular/core@>=2.3.1 <13.0.0 || ^12.0.0-next || ^12.1.0-next || ^12.2.0-next, required by [[email protected]](mailto:[email protected])

[Warn] npm dependencies list contains the package '@angular/common' without version information. The dependency will not be added to build-info.
[Warn] npm dependencies list contains the package '@angular/compiler' without version information. The dependency will not be added to build-info.
[Warn] npm dependencies list contains the package '@angular/core' without version information. The dependency will not be added to build-info.

Describe the solution you'd like to see

Customers would like to disable the 'npm ls' command to be triggered in the background by default as these warning messages might cause confusion to the users who are managing the pipeline jobs

Describe alternatives you've considered

We can set the log level to error by setting the following environment variable ( link ).

JFROG_CLI_LOG_LEVEL=ERROR

@VigneshC-Jfrog VigneshC-Jfrog added the feature request New feature or request label Jun 2, 2022
@pniederlag
Copy link

we currently run into issues with 'jfrog npm ci' as well because "npm ls --json --all --long" yields errors and seems to be running. For - yet unknown reasons - "npm ls" seems to be triggered only when build-name/number/url are set.

@yahavi
Copy link
Member

yahavi commented Aug 14, 2023

@pniederlag
The npm ls command runs when the JFrog CLI is asked to collect and publish build-info for npm. It uses the output to build the dependency list for the build-info.
To prevent running this command, remove the --build-name and the --build-number flags.

Please let me know if that helped.

@pniederlag
Copy link

@pniederlag The npm ls command runs when the JFrog CLI is asked to collect and publish build-info for npm. It uses the output to build the dependency list for the build-info. To prevent running this command, remove the --build-name and the --build-number flags.

Please let me know if that helped.

It helps but seems quite unintuitive. We have JFROG_CLI_BUILD_NAME and JFROG_CLI_BUILD_NUMBER as environment-variables during CI-Run und now must find a way to disable this behaviour. Would be way cleaner if there was an explicit switch or toggle for activating/deactivating integration of build-dependencies.

@pniederlag
Copy link

@yahavi pls also note that there is a somwhat anoying bug in upstream npm wit "npm ls --all --long" on any npm version I have checked, see this report for details and a simple testcase to trigger it: npm/cli#5961

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants