28

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

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

rm -rf node_modules npm install 

It didn't work.

I:

  • ran it as admin,

  • tried npm install -g

  • restarted the XAMPP server

  • turned off Windows Defender

  • checked the PATH for C:\Program Files\nodejs

Output

warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 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 [email protected] No description verbose If you need help, you may report this error at: verbose <https://github.com/npm/npm/issues> warn [email protected] No repository field. verbose If you need help, you may report this error at: verbose <https://github.com/npm/npm/issues> warn [email protected] 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 version 6.9.1.

npm -v gives me version 4.0.2.

Which proves they are all installed fine. Am I right?

1
  • kill any node processes you have running then try again Commented Jan 10, 2017 at 14:05

10 Answers 10

43

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

Know that the possibility to uninstall Node.js 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.js 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)
  1. Check your %PATH% environment variable to ensure no references to Node.js or npm exist.

  2. 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.

  3. Reboot, for good measure.

Sign up to request clarification or add additional context in comments.

6 Comments

This is the true answer. The gotcha here for me was to delete .npmrc from %APPDATA%. I tried everything before without success (even uninstalling).
to check environment variables use the commandline and just type SET
Definitely still the only option I've found that works. Has worked on three separate installations.
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.
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 !
|
6

Please read the error carefully.

It's saying:

[email protected]: 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 the npm dependencies are using fsevents. That's why it’s breaking on Windows.

As you were 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.

10 Comments

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?
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
Hi Please check the updated answer. Hope It will help :)
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"
You're a real life saver. NPM was hanging on NPM install and this fixed the problem.
|
5

Update and then install again:

npm install -g npm-check-updates npm install 

Add this to fix any errors:

npm audit fix 

Comments

3

Please try to open the console as an administrator.

Do right-click on the command line and select "Open as administrator" and then try installing the dependency.

3 Comments

I did that. As I mentioned in my question
please check the permissions you have on your htdocs folder. OR stop your Xampp server and try installing.
refer these links : 1. link 2. link
2

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

And uninstalling Node.js and reinstalling it.

Comments

2

If npm install is not working, then you can use this command:

 npm install --legacy-peer-deps 

This works for me.

1 Comment

worked for me. I have updated angular version 8 to 9. For the first time need to run this command. thanks.
2

If you installed Node.js and npm with nvm, then you can uninstall it with nvm uninstall 5.5.5, and then reinstall with nvm install 5.5.5.

That fixed my issue. I did not have to go in to delete or add modules or change paths.

Comments

0

I tried to disabled all my antivirus and firewall, cleared the npm cache, and did cache verify, but nothing worked. The only thing that works on my end is to install the Node Version Manager, nvm.

How does Node Version Manager work?

Permission errors can occur when packages are installed globally. If this is the case, npm may need to be set up to operate without elevated permissions. This where nvm comes in. It lets you install a different Node.js version without triggering the administrative access.

  1. If you have existing Node.js installed, I recommend uninstalling it like the process given by LOTUSMS above:

    Uninstall from Programs & Features with the uninstaller.

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

    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) Check your %PATH% environment variable to ensure no references to Nodejs or npm exist.

    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.

  2. Install nvm here - https://github.com/coreybutler/nvm-windows. or you can use curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

  3. Run nvm or command -v nvm. If something prints, the installation was successful.

  4. Install the prefered node version - e.g. nvm use 16.3.0

  5. Check if the node and npm are properly install. Just run node -v and npm -v

  6. Enjoy the npm installation :D

Comments

0

this work for me

npm install --force

Comments

0

Is still does not work for you, try this: Go to "C:\Windows\System32" folder and see if you do not have an empty file called “npm”. We used to do this, in the old days in Unix, to prevent people from deleting files.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.