Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve rename error during npm install

I opened the cmd window as administrator and ran npm install on a folder, got this error at one point:

npm ERR! Error: EPERM: operation not permitted, rename 'MyFolder\node_modules\.staging\@angular\common-54da66e9' -> 'MyFolder\node_modules\@angular\common'
npm ERR!     at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)

Same seems to work on other machines!

Can someone help me fix this?

like image 988
praveen_r Avatar asked Jun 30 '17 00:06

praveen_r


People also ask

Why npm install is showing error?

code 1 error usually occurs when you run the npm install command. This cause of this error is that one of the dependencies you define in your package. json file fails to be installed properly on your computer. This means that npm fails to install the node-sass module that's added as a dependency to the n-app project.


2 Answers

I had this problem recently at my work place. In my case what I was doing was, I had the project open in the editor(I use VScode, which is cool:)) and then in the cmd window I was trying to run npm install on the same project folder. I got the same error no matter what I did.

The thing that solved the issue for me is, whenever I try to do npm install I close the editor window in which the project is opened and then run npm install from the cmd window. This works without any issues for me.

By the way I have observed that this is only with windows I guess, on my mac I have never encountered this issue.

like image 76
Sandeep Rao Avatar answered Oct 21 '22 03:10

Sandeep Rao


working under windows 10 I opened the CMD as an administrator and that fixed my issue.

like image 40
Jeffery ThaGintoki Avatar answered Oct 21 '22 01:10

Jeffery ThaGintoki