4

I have researched this extensively and nothing. So I am hoping this generates a different solution.

I keep getting this error

npm WARN packages@1.0.0 No description
npm WARN packages@1.0.0 No repository field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "express"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! path C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'

npm ERR!     at destStatted (C:\Users\Luis\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' ->
 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR!     at destStatted (C:\Users\Luis\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR!     at Error (native) parent: 'packages' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\xampp\htdocs\nodeprojects\contact-list-app\npm-debug.log
  • It's not a Mac, It's a Windows machine, so nothing to do with sudo as other responses suggested here
  • I don't have an antivirus running so this was a no-go too
  • I ran npm cache clean as suggested here and other SO solutions

It was running fine, and then it started doing this when I tried to install angular-ui-bootstrap. but I was able to install other dependencies just fine.

I also did:

  • Restarted my machine
  • used CMD as administrator
  • Used git bash
  • Used npm console
  • Deleted the whole thing and started again in another directory ( got desperate)
  • uninstalled and re-installed node.js
  • drank a lot of coffee, and upgraded to alcohol

Please bail me out.

Community
  • 1
  • 1
LOTUSMS
  • 10,317
  • 15
  • 71
  • 140
  • Have you tried upgrading npm with `npm install -g npm@latest`? – doublesharp Nov 23 '16 at 01:04
  • Funny you'd ask. I was just doing that as I read your comment. I'll be able to tell you if that fixes it in 2 minutes – LOTUSMS Nov 23 '16 at 01:06
  • @doublesharp...no cigar. That didn't fix it either – LOTUSMS Nov 23 '16 at 01:07
  • You might also want to look at the contents of `npm-debug.log`, and if it's still not working look under `.\node_modules` to see if there is a `.staging` and/or a `depd` folder, and what their permissions are. – doublesharp Nov 23 '16 at 01:07
  • It stages the install but it never suceeds so the node_modules folder never gets created – LOTUSMS Nov 23 '16 at 01:08
  • That's weird, it's failing trying to copy folders inside the `node_modules` directory. Can your user `mkdir` in the project folder? Also try running `npm rebuild`. – doublesharp Nov 23 '16 at 01:10
  • ok, I think I got it started. Get this...I had to install npm inside npm to get it to build itself asa dependency – LOTUSMS Nov 23 '16 at 01:13
  • Not sure why that fixed it, but nice work. – doublesharp Nov 23 '16 at 01:14
  • That is the weirdest thing I've ever heard but it got it working and now I am installing other dependencies fine. I don't know if I should suggest that as a solution. I ran 'npm install npm --save' that built the node_modules folder with npm in it as a dependency which I assumen I can remove later – LOTUSMS Nov 23 '16 at 01:15

1 Answers1

1

I am posting this answer, simply because there isn't enough documentation on this error in the web, but please if you have other ideas you'd like to add as a possible solution (other than the ones I tried in my question) please feel free. I'm sure there are a lot of other frustrated developers looking for this. Anyway, this is how I solved it.

I deleted my node_modules folder just so I can re-install the dependencies fresh. This doesn't break anything in your project because as soon as you add them back up, they will be in the exact same place they were before. So, do n't be afraid of the 404s you will get temporarily.

Then I did a fresh install by running

npm init

This get my packages.json file going

And then I tried to install my first dependency, any dependency, pick one. But the error came up and the node_modules didn't even get started. So I got it running by installing npm in itself as a dependency. Why did this work? Beats me! But the mystic powers of node know something I don't and I am ok with that. So I did this basically

npm install npm --save

This built my node_modules folder and I was able to install everything back. I removed the npm dependency afterwards and it's like it was never there.

Again, feel free to post any other solutions. I don't think this is a definite solution so I won't mark it. It just worked for me. Thought I shared it

EDIT

DO NOT delete that npm dependency by running npm uninstall <package> as you normally would. Instead, just delete the dependency with a good 'ol delete key

LOTUSMS
  • 10,317
  • 15
  • 71
  • 140