node.js – NPM clean modules

node.js – NPM clean modules

You can just delete the node_module directory

rm -rf node_modules/

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:

node.js – NPM clean modules

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.

Leave a Reply

Your email address will not be published.