npm - EPERM:在 Windows 上不允许操作

2022-01-30 00:00:00 node.js javascript npm bower npm-install

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)Gitlocal'
at Error (native)

Have deleted all files from

C:Users<your username>.configconfigstore

It did not work.

Any suggestion ?

解决方案

Running this command was my mistake.

npm config set prefix /usr/local

Path /usr/local is not for windows. This command changed the prefix variable at 'C:Program Files (x86)Gitlocal'

To access and make a change to this directory I need to run my cmd as administrator.

So I did:

  1. Run cmd as administrator
  2. Run npm config edit (You will get notepad editor)
  3. Change prefix variable to C:Users<User Name>AppDataRoaming pm

Then npm start works in a normal console.

相关文章