You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This fixes an error in npm show. When calling npm show with a specific
version of a package that does not exist, it does not show anything and
gives a zero exit code. This has been changed: now it gives a 404 Error
similar to if the package does not exist. Can be tested with npm show
express@5.0.0 (local: node bin/npm-cli.js info express@5.0.0)
~/D/n/cli (gar/5011|✔) $ node . view lodash@asdf
npm ERR! code E404
npm ERR! 404 No match found for version asdf
npm ERR! 404 npm ERR! 404 'lodash@asdf' is not in this registry.
npm changed the way the `npm view` command handles missing versions.
Before it exited with a non-error. Now it errors.
Ref: npm/cli#5035
This modifies the script logic to handle those new changes.
jsjoeio added a commit
to coder/code-server
that referenced
this pull request
Aug 23, 2022
* chore: clean up logging in npm script
* fix: catch error if npm version missing
npm changed the way the `npm view` command handles missing versions.
Before it exited with a non-error. Now it errors.
Ref: npm/cli#5035
This modifies the script logic to handle those new changes.
@wraithgar Probably not worth a new issue but I wanted to note that this caused a catastrophic relatively bad release infrastructure failure for the Electron project.
We have since recovered and worked around the issue and ensured the npm is correctly pinned in our deployment environment but this was IMO a drastic breaking change in behaviour in a patch bump of the NPM cli.
Specifically we were checking if a version had been published to npm via the CLI using:
npm show electron@1.2.3 --json
And assuming that "no output" meant the version had not been published and "valid output" could be parsed into the registry metadata. In both cases since the dawn of npm the command exited cleanly, this change caused a non-zero exit code in the unpublished scenario which then propagated as an error through our release scripts causing an infinite backoff-and-retry (as we assumed a non-zero exit code meant npm was having issues).
Not sure if this is even gonna scratch on the radar, but I'd consider a change in exit code semantics for a CLI tool a breaking change and would be reserved for the next major version of npm.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes an error in npm show. When calling npm show with a specific
version of a package that does not exist, it does not show anything and
gives a zero exit code. This has been changed: now it gives a 404 Error
similar to if the package does not exist. Can be tested with npm show
express@5.0.0 (local: node bin/npm-cli.js info express@5.0.0)
Fixes#4964
Credit: @lukaskuhn-lku