Is there a way to delete devDependencies in nodejs without deleting everything. I have no npm on the destination server so I do the following:
$ npm install $ grunt build $ rm -rf node_modules $ npm install --production
Does anyone know if there exists an npm module that can purge installed modules. TIA!
The npm prune command, without any arguments will clean up any packages that are installed and not listed in your dependency lists. Optionally, you can pass in --production which will remove any dependencies that are listed in your devDependencies .
You can use npm-prune to remove extraneous packages. Extraneous packages are packages that are not listed on the parent package's dependencies list. If the --production flag is specified or the NODE_ENV environment variable is set to production, this command will remove the packages specified in your devDependencies.
To remove a package from your node_modules directory, on the command line, use the uninstall command. Include the scope if the package is scoped. This uninstalls a package, completely removing everything npm installed on its behalf.
You can use npm prune --production
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With