npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

I killed my NPM on Windows trying to move some folders. Reinstalling nodejs isn't resetting the problem.

I was trying to change my npm and npm-cache folders to d:\\npm-global and d:\\npm-cache

I managed to do a npm config set cache d:\npm-cache

When I tried to do a npm config set prefix d:\npm-global I accidentally put a ’ in the folder string as I was hitting enter. I deleted the errant folder after trying a npm i -g gulp and to my horror, npm stopped working altogether, it just sits there with my command prompt rocking up to 50% CPU usage.

Help please! I’ve tried searching the registry and other places, even uninstalled and re-installed the nodejs msi package on Windows. This reset the D:\Program Files\nodejs\node_modules\npm\npmrc file.

Still no luck. I can’t get npm to work again. :(

edit A little digging in and I realized there is a second node server running via Adobe Creative Cloud. I doubt this is the problem though as when I run npm from the cmd.exe prompt, the correct (d:\program files\nodejs) version of the npm server is executed for that process.

edit so only sometimes when I hit Control-C, I’ll get this error:

npm error

seems like it’s trying to find a file that doesn’t exist. However, I cleared out the AppData\Roaming\npm folder and the reinstalls reset the default d:\program files\nodejs\....npm\npmrc file. I also made sure that the environment variable NODE_PATH is not set. It wasn’t set when it was working. I set it when I was trying to make my changes.

Are the config values still set, or have you got them back to the defaults?

 npm config get cache
 npm config get prefix

Someone had a similar problem recently, but they fixed it by removing AppData\Roaming\npm\etc\npmrc and sounds like you already did that : Unrecoverable error while transferring npm folder

Thanks for the reply John. Unfortunately, I can’t even run npm to do anything. Even npm --version doesn’t work.

Do you have a config file in your home directory? I don’t know if the location is different on Windows, but on Linux the main .npmrc file is in my home directory.

Config file locations:

(I’ll have a quick look for more Windows friendly description.)

OMFG, thanks Lars!!!

I checked for the C:\Users\userName\AppData\Roaming\npm\etc\npmrc file, and the D:\Program Files\nodejs\...\npm\npmrc file and I was searching through the registry or anywhere there would be another config and totally didn’t check c:\users\userName and there WAS a .npmrc file there! I deleted it and now it works! Thanks!

That’s really strange to have the AppData npmrc and the user home .npmrc. Most examples I read gave me the impression to use the ~/.npmrc if using Linux and AppData npmrc if using Windows.

Problem solved (until I try again to move these folders :stuck_out_tongue: ). Thanks Lars and John! Much appreciated.

The AppData location might be for when use --global with config.

Glad solved for now, and good luck when you try moving again. :-)

I just did a little test, just for knowledge sake. Apparently it doesn’t matter if I do npm config set prefix d:\npm-global --global or without the --global. Once the prefix is set to d:\npm-global, even without the --global flag, the AppData/npm folder is (or can be?) empty.

Thus the AppData/npm/etc/npmrc is just (from a user config point of view) a useless copy of the c:\users\userName\.npmrc. And the .npmrc in c:\users\userName gets set with or without the --global flag.