13

I have no idea what is happening here. Hoping someone can help me.

This works great in my mac. But same process in Windows and npm install crashes. This is what I get.

EDIT

I've tried everything I've seen in SO so far and every link Google search produced. I tried the following as suggested here:

rm -rf node_modules
npm install

Didn't work

Ran it as admin,

tried npm install -g

re-started xampp server

turned off Windows defender

checked the PATH for C:\Program Files\nodejs

Short of throwing this POS Windows threw a window, pun intended, I've done everything. Hail Apple!

warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
warn fuse@1.4.4 No description
verbose If you need help, you may report this error at:
verbose     <https://github.com/npm/npm/issues>
warn fuse@1.4.4 No repository field.
verbose If you need help, you may report this error at:
verbose     <https://github.com/npm/npm/issues>
warn fuse@1.4.4 No license field.
verbose If you need help, you may report this error at:
verbose     <https://github.com/npm/npm/issues>
verbose stack Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
verbose stack     at destStatted (C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
verbose stack     at C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:276:29
verbose stack     at FSReqWrap.oncomplete (fs.js:123:15)
verbose stack
verbose stack Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
verbose stack     at Error (native)
verbose cwd C:\xampp\htdocs\ScalaCM
error Windows_NT 10.0.14393
error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Luis\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
error node v6.9.1
error npm  v4.0.2
error path C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290
error code EPERM
error errno -4048
error syscall rename
error Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
error     at destStatted (C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
error     at C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:276:29
error     at FSReqWrap.oncomplete (fs.js:123:15)
error
error Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
error     at Error (native)
error  { Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
error     at destStatted (C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
error     at C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:276:29
error     at FSReqWrap.oncomplete (fs.js:123:15)
error
error Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
error     at Error (native) parent: 'fuse' }
error Please try running this command again as root/Administrator.
verbose exit [ -4048, true ]

node -v gives me a version v6.9.1

npm -v gives me a version as well 4.0.2

Which proves they are all installed fine, am I right?

Community
  • 1
  • 1
LOTUSMS
  • 8,793
  • 13
  • 49
  • 108

5 Answers5

18

After countless hours of debugging and researching, I decided to install in a different machine to see if the problem was with my Node installation. It worked.

So for everyone who may come across this, know that the possibility to uninstall node and delete NPM will be there. This is what I did. I believe it is the safest way to solve the problem and all the rest of your applications installed in your machine will still work. I credit this answer for these steps, although I had other npm and node_modules in other locations. So do a quick search for these and unless they are part of an application, make sure they are deleted as well.

  1. Uninstall from Programs & Features with the uninstaller.

  2. Reboot (or you probably can get away with killing all node-related processes from Task Manager).

  3. Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:

    • C:\Program Files (x86)\Nodejs
    • C:\Program Files\Nodejs
    • C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
    • C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
    • C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)
  4. Check your %PATH% environment variable to ensure no references to Nodejs or npm exist.

  5. If it's still not uninstalled, type where node at the command prompt and you'll see where it resides -- delete that (and probably the parent directory) too.

  6. Reboot, for good measure.

Community
  • 1
  • 1
LOTUSMS
  • 8,793
  • 13
  • 49
  • 108
  • 3
    This is the true answer. The gotcha here for me was to delete .npmrc from %APPDATA%. I tried everything before without success (even uninstalling). – AdrianoRR Feb 19 '18 at 21:46
  • to check environment variables use the commandline and just type `SET` – tony09uk Apr 27 '18 at 15:30
  • 1
    Definitely still the only option I've found that works. Has worked on three separate installations. – Andrew Jun 19 '18 at 19:17
  • You can't 'fix' npm if it breaks (as described here). These instructions on how to nuke the site from orbit are the only way to be sure. – msenne Nov 12 '20 at 20:33
  • 1
    This is perfect answer. You really saved my day I had already spent 4 days in this issue tried many solutions but this is full detailed answer that really help me out. Cheers ! – Narendrasingh Sisodia Mar 08 '21 at 07:43
4

Please read the error carefully. It's saying :

fsevents@1.0.17: wanted {"os":"darwin","arch":"any"}

The FSEvents API in OS X allows applications to register for notifications of changes to a given directory tree.

It needs OS X, Because some of npm dependencies are using fsevents that's by It's breaking in windows.

https://github.com/strongloop/fsevents

Update:

As you told It's working without fsevents then you can follow these steps:

install npm-check-updates and try again.

 npm install -g npm-check-updates
 ncu -u       #It will update the npm dependencies.
 rm -fr node_modules
 npm install

It will update the dependencies and install the dependencies.
Hope It will work :)

Vishnu Mishra
  • 2,768
  • 2
  • 19
  • 32
  • oh, ok, I see now. SO how do I change it so that it is cross-OS? I inherited this from another developer who quit. I can't just ask him where he put this or how he did it. Any idea of where I should look or how to change it globally? – LOTUSMS Jan 10 '17 at 14:43
  • I ran the application in a mac after uninstalling fsevents and it still runs in t a mac. So I'm safe not having it. But I can't figure out how to remove it or stop it from blocking a WIndows install – LOTUSMS Jan 10 '17 at 14:59
  • Hi Please check the updated answer. Hope It will help :) – Vishnu Mishra Jan 10 '17 at 18:13
  • It did't work. Same error. But it says it is optional so I ran $npm install --no-optional and that error went away but I still can't install. I am getting this npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Luis\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--no-optional" – LOTUSMS Jan 10 '17 at 18:45
  • And also this npm ERR! { Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\acorn-4ac2b9e1' -> 'C:\xampp\htdocs\ScalaCM\node_modules\acorn' – LOTUSMS Jan 10 '17 at 18:47
  • Try this: npm cache clean – Vishnu Mishra Jan 10 '17 at 18:50
  • if still not work : %APPDATA%\npm-cache check these links 1. http://stackoverflow.com/questions/34600932/npm-eperm-operation-not-permitted-on-windows 2. https://blogs.msdn.microsoft.com/matt-harrington/2012/02/23/how-to-fix-node-js-npm-permission-problems/ – Vishnu Mishra Jan 10 '17 at 18:55
  • nothing. and the last one is not recognized as an internal or external command – LOTUSMS Jan 10 '17 at 18:57
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/132845/discussion-between-vishnu-mishra-and-lotusms). – Vishnu Mishra Jan 10 '17 at 18:57
  • 1
    You're a real life saver. NPM was hanging on NPM install and this fixed the problem. – Eric Wiener Jul 19 '18 at 15:03
1

please try to open the console as a administrator. do right Click on the commandLine and select "open as administrator" then try installing dependency.

Darpan Rangari
  • 995
  • 6
  • 20
  • I did that. As I mentioned in my question – LOTUSMS Jan 10 '17 at 14:03
  • please check the permissions you have on your htdocs folder. OR stop your Xampp server and try installing. – Darpan Rangari Jan 10 '17 at 14:05
  • refer these links : 1. [link](http://stackoverflow.com/questions/39293636/npm-err-error-eperm-operation-not-permitted-rename) 2. [link](http://stackoverflow.com/questions/16989013/eperm-operation-not-permitted-error-config-store) – Darpan Rangari Jan 10 '17 at 14:07
1

update and then install again

npm install -g npm-check-updates

npm install

add this to fix any errors

npm audit fix

yatheesha
  • 11
  • 1
1

The only solution that worked for me was deleting npm and npm-cache from C:\Users(your username)\AppData\Roaming Uninstalling nodejs and reinstalling it