npm ERR! Error: EPERM: operation not permitted, re

2019-01-13 18:18发布

When I execute "npm install" I get this error

npm ERR! Error: EPERM: operation not permitted, rename C:\projects\******\node_modules\react-async-script' -> 'C:\projects\*******\node_modules\.react-async-script.DELETE'
  • I am running the cmd as administrator
  • I ran npm cache clean before
  • I made sure all the other applications dont have anything related to node_modeules open

16条回答
forever°为你锁心
2楼-- · 2019-01-13 18:24

I had the same problem after updating to npm to 5.4.2, npm start giving the same error for most npm commands. Some solution suggest to run it with --no-optional:

it didn't work always.

other suggested to downgrade, i didn't want to downgrade.

I suspected that there was a problem with the installation, not sure what it is.

so i re-updated my npm:

npm i -g npm

and worked fine since then.

查看更多
We Are One
3楼-- · 2019-01-13 18:26

npm was failing for me at scandir for:

npm install -g webpack

...which might be caused by npm attempting to "modify" files that were potentially locked by other processes as mentioned here and in few other github threads. After force cleaning the cache, verifying cache, running as admin, disabling the AV, etc the solution that actually worked for me was closing any thing that might be placing a lock the files (i.e. restarting my computer).

I hope this helps someone struggling.

查看更多
萌系小妹纸
4楼-- · 2019-01-13 18:27

For some, AppRoot\npm folder could be an issue. Sometimes the AppRoot folder is marked as network shared and thus Antivirus blocks the stuff. Follow below link for complete solution.

https://alastaircrabtree.com/fixing-intermittant-eperm-operation-not-permitted-on-npm-install/

I hope this helps.

查看更多
仙女界的扛把子
5楼-- · 2019-01-13 18:28

I was getting the same thing. I didn't find this anywhere but it hit me that our VMs tend to change files to a read-only state. So I opened package.json's file properties and deselected Read-only in the "General" tab.

Steps

  1. Go to the package.json file.
  2. Right-click and select Properties.
  3. In the General tab, Attributes section, deselect Read-only.
  4. Click Apply to apply the change.
查看更多
Juvenile、少年°
6楼-- · 2019-01-13 18:31

I had the same problem. The reason for the error is unsupported characters in the path to the file. Replaced the cyrillic in English - it helped.

查看更多
Viruses.
7楼-- · 2019-01-13 18:31

My answer is to do npm cache clean --force first. Then run npm install -g npm@5.3.0 to install npm 5.3.0 version. for me, this npm version works with no trouble.

查看更多
登录 后发表回答