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 shrinkwrap renames out of date package-lock #3951

Open
1 task done
aovchinn opened this issue Oct 27, 2021 · 3 comments
Open
1 task done

[BUG] npm shrinkwrap renames out of date package-lock #3951

aovchinn opened this issue Oct 27, 2021 · 3 comments
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@aovchinn
Copy link

aovchinn commented Oct 27, 2021

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

with disabled package-locks in npm config npm shrinkwrap command produces different result based on presense of package-lock.json file

if it is present it just renames it, but actual node_modules could be different at that moment
if it is not present it would calculate up to date npm-shrinkwrap.json

Expected Behavior

npm shrinkwrap should give the same output with or without package-lock.json
shrinkwraps from case (a) and case (b) in Steps To Reproduce should be the same
I expect them to be, should they though ?

Steps To Reproduce

case (a)

  • npm install (package-lock.json generated)
  • set package-lock = false in npm config
  • update version of a package in package.json
  • npm install
  • npm shrinkwrap (just a rename of old, outdated package-lock.json)

case (b)

  • all steps from case (a)
  • rm package-lock.json npm-shrinkwrap,json
  • npm shrinkwrap (new shrinkwrap is generated, with up to date data from node_modules)

Environment

  • OS: Windows 10 Home 21H1 19043.1288
  • Node: v16.13.0
  • npm: 8.1.1
@aovchinn aovchinn added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Oct 27, 2021
@aovchinn
Copy link
Author

in this repo https://github.com/aovchinn/npm-shrinkwrap
npm-shrinkwrap-saved.json is a result of npm-srinkwrap with present package-lock.json
npm-shrinkwrap.json is a result of npm shrinkwrap without package-lock.json

@lukekarrys lukekarrys removed the Needs Triage needs review for next steps label Nov 3, 2021
@lukekarrys lukekarrys self-assigned this Nov 3, 2021
@lukekarrys lukekarrys added the Priority 1 high priority issue label Nov 3, 2021
@darcyclarke
Copy link
Contributor

Update

  • this can potentially be closed - let's re-triage steps to reproduce to confirm though

@lukekarrys lukekarrys changed the title [BUG] npm shrinkwrap ambiguous behavior [BUG] npm shrinkwrap renames out of date package-lock Mar 22, 2022
@lukekarrys lukekarrys added Priority 2 secondary priority issue and removed Priority 1 high priority issue labels Mar 23, 2022
@lukekarrys
Copy link
Contributor

This is still an issue. I think the issue is that we don't error in the "case a" (npm shrinkwrap (just a rename of old, outdated package-lock.json)), similar to the recent change made in #4599. The fix should be to throw an error if the package-lock is out date before attempting to shrinkwrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

3 participants