NPM clean modules
Is there a way to get npm to unbuild all the modules under node_modules? Something like npm rebuild that removes all build artifacts but doesn't rebuild them?
Solution 1:
You can just delete the node_module directory
rm -rf node_modules/
Solution 2:
There is actually special command for this job
npm ci
It will delete node_modules
directory and will install packages with respect your package-lock.json
file
More info: https://docs.npmjs.com/cli/ci.html
Solution 3:
I added this to my package.json:
"build": "npm build",
"clean": "rm -rf node_modules",
"reinstall": "npm run clean && npm install",
"rebuild": "npm run clean && npm install && npm run build",
Seems to work well.