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

[BUG] npm install <name> does not install latest tag if it is deprecated, and pre-release #7873

Closed
2 tasks done
everett1992 opened this issue Oct 22, 2024 · 3 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@everett1992
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npx [email protected] install @aws-sdk/add-glacier-checksum-headers-browser
npm error code ETARGET
npm error notarget No matching version found for @aws-sdk/add-glacier-checksum-headers-browser@*.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.

Expected Behavior

I would expect this to succeed and install 0.1.0-preview.2, because it is the latest dist-tag.

$ npx [email protected] info @aws-sdk/add-glacier-checksum-headers-browser deprecated version dist-tags.latest
deprecated = 'The package @aws-sdk/add-glacier-checksum-headers-browser was released in Developer Preview. It is no longer supported.'
version = '0.1.0-preview.2'
dist-tags.latest = '0.1.0-preview.2'

Or, the command should error with a clear message because the version is deprecated and prerelease, which should be strongly discouraged from being used. However, ETARGET error is wrong.

It appears to only happen with deprecated prerelease versions. If the latest tag is 1.0.0 and deprecated npm will install it.
npm will even install a different, non prerelease, version

package latest deprecated other versions behavior
calebev-prerelease-test-a 1.0.0 yes none install 1.0.0, no issue
calebev-prerelease-test-b 1.0.0-prerelease yes none errors ETARGET
calebev-prerelease-test-c 1.0.0-prerelease yes 1.0.0 install 1.0.0

Steps To Reproduce

  1. In an empty npm package
  2. With this config {}
  3. Run npx [email protected] install calebev-prerelease-test-b''
  4. See error...

Or @aws-sdk/add-glacier-checksum-headers-browser

npm error code ETARGET
npm error notarget No matching version found for calebev-prerelease-test-b@*.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.

Environment

  • npm: 10.9.0
  • Node.js: 22.8.0
  • OS Name: Ubuntu
  • System Model Name: N/A
  • npm config:
; none
@everett1992 everett1992 added Bug thing that needs fixing Needs Triage needs review for next steps labels Oct 22, 2024
@milaninfy
Copy link
Contributor

Closing: this appears to be working as expected.

@everett1992
Copy link
Author

Is there any corresponding documentation change? This changed since npm 10.8 and I didn't see it in any change log. It's not explained by the npm install documentation, and the error message is not informative.

@shazron
Copy link

shazron commented Nov 21, 2024

I believe this new behavior started with [email protected] or greater (bundled starting with [email protected])
Note item 3 in the list below, there are three new clauses in the check, plus one new clause in the enclosing if statement.

Supporting info:

  1. https://docs.npmjs.com/cli/v10/using-npm/changelog#1082-2024-07-09
  2. https://github.com/npm/npm-pick-manifest/releases/tag/v9.1.0
  3. npm/npm-pick-manifest@9f5560f
  4. Add note about using EOL release versions nodejs/nodejs.org#6913
  5. node version to npm version mappings: https://nodejs.org/dist/index.json

I couldn't find the documentation change either -- but from item 4 it appears that the intent is the corrected behavior, so it's a bug fix, thus we might have relied on a bug before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

4 participants
@shazron @everett1992 @milaninfy and others