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


(Chi11ax) #1

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.


(John Gee) #2

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


(Chi11ax) #3

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


(Lars Willighagen) #4

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.


(John Gee) #5

Config file locations: https://docs.npmjs.com/files/npmrc

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


(Chi11ax) #6

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.


(John Gee) #7

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

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


(Chi11ax) #8

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.


(system) closed #9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.