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] dist-tag in package.json not re-evaluated #7562

Open
2 tasks done
SchulteMarkus opened this issue May 28, 2024 · 2 comments
Open
2 tasks done

[BUG] dist-tag in package.json not re-evaluated #7562

SchulteMarkus opened this issue May 28, 2024 · 2 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@SchulteMarkus
Copy link

SchulteMarkus commented May 28, 2024

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

Context

I am using a packages npm-dist-tag in my package.json

// An example
"devDependencies": {
  "nx": "canary"
}

Running npm i after adding such a dependency to the package.json works as intended, for time being 19.2.0-canary.20240528-7f11a1d of nx is being fetched and written to the package-lock.json.

dist-tag not re-evaluated

Now, I am using a npm-dist-tag, which does not exist:

"devDependencies": {
  "nx": "dist-tag-not-available-oohhhhhh"
}

Running npm i after adding such a dependency does not work - which is in my opinion correct:

$ npm i
npm error code ETARGET
npm error notarget No matching version found for nx@dist-tag-not-available-oohhhhhh.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.

But, if I first install nx=canary as I described in context, and change canary to dist-tag-not-available-oohhhhhh in the package.json afterwards, npm i just works fine. The package-lock.json remains untouched in this case, with nx still pointing to 19.2.0-canary.20240528-7f11a1d

Additional question

I wonder, what happens when nx=canary is being used, and the canary dist-tag gets updated - does npm i update the actual version of nx?

Expected Behavior

In the second case, when a npm-dist-tag in the packge.json is being changed to a non-existing one, I would expect NPM to throw an error as it does, when I try to init such a dependency.

Steps To Reproduce

  1. Add nx=canary as dependency to package.json
  2. npm i (nx is being installed)
  3. Change nx to nx=dist-tag-not-available-oohhhhhh in package.json
  4. npm i => executes just fine, nx=canary remains, no error

Environment

npm: 10.8.0
Node.js: v20.10.0
OS Name: Windows 11
System Model Name: Lenovo IdeaPad

@SchulteMarkus SchulteMarkus added Bug thing that needs fixing Needs Triage needs review for next steps labels May 28, 2024
@SchulteMarkus
Copy link
Author

Related npm/rfcs#607

@aryzing
Copy link

aryzing commented Nov 26, 2024

This behavior would be very useful, and I believe the most expected. Similarly, I was looking forward to conveniently reference a context of possibly changing code without having to constantly update the version number. Analogous to how DNS works for IP addresses.

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

2 participants