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 it both on linux Centos
and on Windows 8
.
Thanks in advance!
To reset user defaults
Run this in the command line (or git bash on windows):
echo "" > $(npm config get userconfig)
npm config edit
To reset global defualts
echo "" > $(npm config get globalconfig)
npm config --global edit
If you need sudo that run this instead:
sudo sh -c 'echo "" > $(npm config get globalconfig)'
If you run npm config edit
, you'll get an editor showing the current configuration, and also a list of options and their default values.
But I don't think there's a 'reset' command.
If it's about just one property - let's say you want to temporarily change some default, for instance disable CA checking: you can do it with
npm config set ca ""
To come back to the defaults for that setting, simply
npm config delete ca
To verify, use npm config get ca
.
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.
FWIW you can reset just the registry to the default with npm config rm registry
.