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

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


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.


I got it working when tried npm install with a force option to fetch remote resources even if a local copy exists on disk. Try running

npm install --force

UpdatedFor some of my colleagues this solution was not working. But we tried using yarn instead of npm. It works (faster as well) without any issues all the time

yarn install [package-name]


Not package.json, but for whatever reason, my node_modules/ had become read-only. Resetting that fixed this.