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

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 don’t have anything related to node_modules open

45 Answers
45

In my situation this helped:

Before proceeding to execute these commands close all VS Code instances.

  1. clean cache with

     npm cache clean --force
    
  2. install the latest version of npm globally as admin:

     npm install -g npm@latest --force
    
  3. clean cache with

     npm cache clean --force
    
  4. Try to install your component once again.

I hope this fix your issue. If not, you may temporarily disable your antivirus program and try again.

Leave a Comment