Is there an existing issue for this?
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
- Clone the repository where I am running into this issue
- Check out the following commit: 1ed2620e9c55ae9cf6679729af2d280f40d0a6ef
- Run
npm install
- Run
npx prettier --version -> It logs 2.2.1 which is correct as it is also specified in the root package.json
- Checkout out the following commit: 491582f854802521f33a936c59d3bd6881004f36
- Run
npm install again
- Run
npx prettier --version again -> It still logs 2.2.1, although the root package.json specified prettier at version 2.3.0
- Delete all
node_modules folders in the workspace and child workspaces
- Run
npm install again
- 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
Is there an existing issue for this?
Current Behavior
I've ran into an issue where running
npm installafter checking out a different branch does not update the localnode_modulesfolder 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_modulesfolders in the workspace and runningnpm installagain installs the correct version. I assume it has something to do with cache detection and not fully runningnpm installbecause npm thinks everything is already correctly installed.The issue might be related to #3196.
Expected Behavior
Running
npm installshould have the same results if it is being run withnode_modulespresent or not-present. In particular dependencies should be updated if a dependency's version has changed in package.json.Steps To Reproduce
npm installnpx prettier --version-> It logs 2.2.1 which is correct as it is also specified in the rootpackage.jsonnpm installagainnpx prettier --versionagain -> It still logs 2.2.1, although the root package.json specified prettier at version 2.3.0node_modulesfolders in the workspace and child workspacesnpm installagainnpx prettier --versionagain -> It now correctly logs 2.3.0Environment