question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove node_modules when switching betweeen npm & pnpm

See original GitHub issue

Related 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:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
web-padawancommented, Feb 10, 2020

Wouldn’t the presence of node_modules/.modules.yaml be enough to detect the structure?

0reactions
denis-anisimovcommented, Feb 10, 2020

So yes, it’s better to rely on node_modules structure if possible.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found