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 does not update node_modules based on newer package.json #3297

Closed
1 task done
peterjuras opened this issue May 24, 2021 · 0 comments
Closed
1 task done
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@peterjuras
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I've ran into an issue where running npm install after checking out a different branch does not update the local node_modules folder and there is still an old version of a module installed - even though the package.json file contains an updated version of the dependency.

Deleting all node_modules folders in the workspace and running npm install again installs the correct version. I assume it has something to do with cache detection and not fully running npm install because npm thinks everything is already correctly installed.

The issue might be related to #3196.

Expected Behavior

Running npm install should have the same results if it is being run with node_modules present or not-present. In particular dependencies should be updated if a dependency's version has changed in package.json.

Steps To Reproduce

  1. Clone the repository where I am running into this issue
  2. Check out the following commit: 1ed2620e9c55ae9cf6679729af2d280f40d0a6ef
  3. Run npm install
  4. Run npx prettier --version -> It logs 2.2.1 which is correct as it is also specified in the root package.json
  5. Checkout out the following commit: 491582f854802521f33a936c59d3bd6881004f36
  6. Run npm install again
  7. Run npx prettier --version again -> It still logs 2.2.1, although the root package.json specified prettier at version 2.3.0
  8. Delete all node_modules folders in the workspace and child workspaces
  9. Run npm install again
  10. Run npx prettier --version again -> It now correctly logs 2.3.0

Environment

  • OS: WSL Ubuntu (5.4.72-microsoft-standard-WSL2)
  • Node: 14.17.0
  • npm: 7.14.0
@peterjuras peterjuras added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels May 24, 2021
@nlf nlf removed the Needs Triage needs review for next steps label May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

2 participants