How to restore/reset npm configuration to default values?

node.js, npm

Solution

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 defaults

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

If you need sudo then run this instead:

sudo sh -c 'echo "" > $(npm config get globalconfig)'

Problem

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.

Original source