I have played with npm set
and npm config set
for several times, now I want to reset to default values (a kind of factory reset).
Does npm
provide a command to do that? Or should I delete all configuration files by hands then reinstall it?
I need to do it both on Linux CentOS and on Windows 8.
npm config edit Opens the config file in an editor. Use the --global flag to edit the global config. now you can delete what ever the registry's you don't want and save file. npm config list will display the list of available now.
There are two ways to clean up the node_modules folder: Delete the folder and reinstall. Use npm prune (starting with npm version 6)
Run this in the command line (or git bash on windows):
echo "" > $(npm config get userconfig) npm config edit
echo "" > $(npm config get globalconfig) npm config --global edit
sudo sh -c 'echo "" > $(npm config get globalconfig)'
For what it's worth, you can reset to default the value of a config entry with npm config delete <key>
(or npm config rm <key>
, but the usage of npm config rm
is not mentioned in npm help config
).
Example:
# set registry value npm config set registry "https://skimdb.npmjs.com/registry" # revert change back to default npm config delete registry
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