npm - EPERM: operation not permitted on Windows

2020-01-24 02:19发布

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 ?

27条回答
We Are One
2楼-- · 2020-01-24 02:41

Sometimes, all that's required is to stop the dev server before installing/updating packages.

查看更多
霸刀☆藐视天下
3楼-- · 2020-01-24 02:41

I updated my node version to 8.9.4 and ran the necessary install command again from administrator command prompt. It worked for me!

查看更多
The star\"
4楼-- · 2020-01-24 02:42

Simplest way

Hope I am not too late for this post but recently even I too got hit by this issue. And also I had no admin rights on my laptop.

Here is the simplest way I fixed the bug.

  1. Locate the file name .npmrc (it will be in C:\Users\<user name>\.npmrc)
  2. Open it and change the path of prefix= to prefix=C:\Users\<user name>\AppData\Roaming\npm

hope it will be helpful..

查看更多
乱世女痞
5楼-- · 2020-01-24 02:43

I use Windows 10. I started the CMD as administrator, and it solved the problem.

Find CMD, right click, and click open as administrator.

查看更多
可以哭但决不认输i
6楼-- · 2020-01-24 02:44

This is occurring because windows is not giving permission to the user to create a folder inside system drive. To solve this:

Right Click

The Folder > Properties > Security Tab

Click on Edit to change Permissions > Select the user and give Full Control to that user.

查看更多
smile是对你的礼貌
7楼-- · 2020-01-24 02:45

A reboot of my laptop and then

npm install

worked for me!

查看更多
登录 后发表回答