Cause:
created in the installation directory node.js two folders, node_cache and node_global , and then set the command line:
npm config set cache "D:\nodejs\node_cache"
npm config set prefix "D:\nodejs\node_global"
Set cache folder and set the global module storage path.
The result is that the input and npm any relevant command will error:
As long as the emergence of this error, anyway reinstall nodejs will repeat this error.
Solution:
Manually change the " C: \ the Users \ Administrator.npmrc " file to open in Notepad, as follows:
prefix = C: \ Program
because the directory does not exist, it has been an error, the text is amended as follows correct configuration path :
= D prefix: \ nodejs \ node_global
Cache = D: \ nodejs \ node_cache
reopening the command line, run the command npm to normal.