I used the ‘npkill’ console app to delete and clean up the numerous node modules packages from my practice projects just sitting on my machine. I went to far and deleted the NodeJS node modules packages. What’s the best way to handle this? It seems I can’t just install/uninstall given that the brain has been removed ![]()
As long as you still have package.json in the project directory, you can restore all dependencies without reinstalling Node.js.
Navigate to the project directory and run:
npm install
npm will read package.json and regenerate the node_modules folder with the required packages.
If you have a package-lock.json file, you can run:
npm ci
npm ci does a clean install directly from your lockfile, which is faster and ensures the exact dependency versions are restored.
2 Likes
Ah. I’m using nvm. Apparently npkill zapped the json files as well.