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 does not respect package.json dependencies #996

Closed
yuri-karadzhov opened this issue Mar 10, 2020 · 4 comments
Closed

[BUG] npm does not respect package.json dependencies #996

yuri-karadzhov opened this issue Mar 10, 2020 · 4 comments

Comments

@yuri-karadzhov
Copy link

yuri-karadzhov commented Mar 10, 2020

What / Why

Npm does not respect package.json dependencies. Lock file is missing and switched off in .npmrc:

package-lock=false

In package.json dependencies are set to latest minor e.g.

"dependencies": {
  "@hqjs/hq": "^0.0.15"
}

later versions of dependencies are available (e.g. @hqjs/hq@0.0.16), but during npm install instead of latest minor the exact ones (ignoring minor flag) that are specified in package.json are installed (e.g. @hqjs/hq@0.0.15).

When

Every time during npm install

Where

Any npm public repository

Steps to Reproduce

  1. Create new project folder
  2. Create .npmrc configuration inside this project folder with package-lock=false content
  3. Init npm project with npm init
  4. Specify dependencies "@hqjs/hq": "^0.0.15"
  5. Run npm install

Current Behavior

@hqjs/hq@0.0.15 will be installed. Newest version 0.0.16 will be ignored despite of package.json configuration

Expected Behavior

@hqjs/hq@0.0.16 should be installed (as a latest minor for this moment)

System

OS: macOS Catalina 10.15.3
node: v12.6.0
npm: 6.14.2

@ljharb
Copy link
Contributor

ljharb commented Mar 10, 2020

In general, the ^ does not guarantee any later version will be installed; if something else already requires it, it dedupes rather than forcing a newer version.

For 0.0.x, ^ is meaningless - it only says “up to the next x” in x.y.z, 0.x.y, or 0.0.x (ie, the x is the major in those three patterns).

@yuri-karadzhov
Copy link
Author

yuri-karadzhov commented Mar 10, 2020 via email

@ljharb
Copy link
Contributor

ljharb commented Mar 10, 2020

No, ^ doesn’t mean “latest minor” - it means “this version, or any version up to but not including the next major” - any of which will satisfy the dependency.

@yuri-karadzhov
Copy link
Author

yuri-karadzhov commented Mar 10, 2020 via email

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

No branches or pull requests

2 participants