Improve error messaging when installing an incompatible npm version #1134
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.
When installing
npm@10
withnode@16
, users are seeing error messages like this:Unable to install npm >=9; does it exist?
.The issue here is that
npm@10
has minimum requirements for the Node.js version it works with: https://github.com/npm/cli/blob/3f9aa452061cde22de1babb33fd9bed8f2b6e3a5/package.json#L257The
npm
command emits an error message explaining the issue that looks like this:However, due to the use of shell redirection in the buildpack, the error message never makes it to the user.
This PR drops the stderr redirection so that the underlying error message does appear. In order prevent other needless output on stderr,
--no-progress
and--no-audit
have been added to the install command.I've also added another hint to the final error message about compatibility.
Related:
KB article explaining the situation and a solution
GUS Work Item