damphat damphat -3 years ago 333
Node.js Question

How to restore/reset npm configuration to default values?

I have played with

npm set
npm config set
for several times, now I want to reset to default values (a kind of factory reset).

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!

Answer Source

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)'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download