npm install not working in windows

前端 未结 5 762
情深已故
情深已故 2020-12-14 13:17

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 ge

相关标签:
5条回答
  • 2020-12-14 13:22

    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.

    0 讨论(0)
  • 2020-12-14 13:24

    update and then install again

    npm install -g npm-check-updates
    

    npm install

    add this to fix any errors

    npm audit fix

    0 讨论(0)
  • 2020-12-14 13:35

    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 :)

    0 讨论(0)
  • 2020-12-14 13:36

    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

    0 讨论(0)
  • 2020-12-14 13:41

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

    0 讨论(0)
提交回复
热议问题