Lahar Shah Lahar Shah - 4 months ago 234x
Node.js Question

npm - EPERM: operation not permitted on Windows

I ran

npm config set prefix /usr/local

After running that command,
When trying to run any npm commands on Windows OS I keep getting the below.

Error: EPERM: operation not permitted, mkdir 'C:\Program Files (x86)\Git\local'
at Error (native)

Have deleted all files from

C:\Users\<your username>\.config\configstore\

It did not work.

Any suggestion ?

npm config set prefix /usr/local

(This path is not for windows, I mad mistake by running this) This command changed prefix variable to 'C:\Program Files (x86)\Git\local'

To Access this directory I need to run my cmd as administrator.

So What I did is

1. Run cmd as administrator 
2. Run npm conig edit (You will get editor)
3. Change Prefix variable to 'C:\Users\<User Name>\AppData\Roaming\npm'

So that's it. Then npm command start working perfectly in normal console.