Remove node_modules when switching betweeen npm & pnpm
See original GitHub issueRelated to #7461, when we detect a switch between npm/pnpm, we delete the old incompatible lock file and a new one is created.
Since npm and pnpm use a different node_modules
folder structure, it would make sense to delete it after deleting the old lock file. This might take a bit longer first but would prevent bloating the disk with lots of unused files (or symlinks).
The folder should only be removed when it is detected present in the project root folder.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to clean node_modules folder of packages that are not in ...
You could remove your node_modules/ folder and then reinstall the dependencies from package.json. rm -rf node_modules/ npm install.
Read more >remove-node-modules - npm
Helps Windows developers remove node modules folder. ... Start using remove-node-modules in your project by running `npm i ...
Read more >How to clean up node modules? - Mario Kandut
npm prune removes extraneous packages. If a package name is provided, then only packages matching one of the supplied names are removed.
Read more >How to Delete ALL node_modules folders on your machine
Make sure to list all node_modules in a given directory BEFORE deleting them. · Make sure to be cautious as this process is...
Read more >.npmrc | pnpm
Controls the way packages are imported from the store (if you want to disable symlinks inside node_modules , then you need to change...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wouldn’t the presence of
node_modules/.modules.yaml
be enough to detect the structure?So yes, it’s better to rely on
node_modules
structure if possible.