How to restore / reset npm configuration to defaults?

I played with npm set and npm config set several times, now I want to reset to use the default values ​​(kind of factory reset).

Does npm provide a command for this? or should I delete all configuration files by hand and then reinstall it?

I need this on both linux Centos and Windows 8 .

Thanks in advance!

+64
Jan 05 '14 at 13:51 on
source share
5 answers

In reset user defaults

Run this on the command line (or git bash in windows):

 echo "" > $(npm config get userconfig) npm config edit 

In reset global values

 echo "" > $(npm config get globalconfig) npm config --global edit 

If you need sudo to run this instead:

 sudo sh -c 'echo "" > $(npm config get globalconfig)' 
+107
Jan 05 '14 at 2:09
source share
— -

If you run npm config edit , you will get an editor that displays the current configuration, as well as a list of parameters and their default values.

But I do not think there is a reset command.

+28
Jan 05 '14 at 2:03
source share

If we are talking about only one property - let's say you want to temporarily change some default values, for example, turn off the CA check: you can do this with

npm config set ca ""

To return to the default settings for this parameter, simply

npm config delete ca

To check, use npm config get ca

+8
Feb 28 '14 at 10:26
source share

For whatever cost, you can reset the default configuration value using npm config delete <key> (or npm config rm <key> , but using npm config rm 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 
+7
Nov 20 '18 at 23:42
source share

Npm configuration editing

Opens the configuration file in the editor. Use the -global flag to change the global configuration. Now you can delete any registry that you do not need and save the file.

npm configuration list will display a list of available now.

+3
Aug 17 '17 at 13:07 on
source share



All Articles