'npm install' extremely slow on Windows

后端 未结 13 1687
面向向阳花
面向向阳花 2020-12-24 04:35

For me is npm install extremely slow. I\'m using Windows 8.1 with the latest npm version. My connection speed is around 100Mbit/s.

The project I\'m tryi

相关标签:
13条回答
  • 2020-12-24 04:53

    I ran into the same problem, using --verbose as peterh mentioned showed me the source of the problem: I am behind a proxy, which uses its own certificates for https-connections. According to user "Mletter1" on https://github.com/npm/npm/issues/8872 the issue is quite easily solved by using http:

    npm config set registry http://registry.npmjs.org/ --global
    

    And voilà, it's fast again. Of course you should only do this, if you're ok with cleartext npm infos over the net ;-)

    0 讨论(0)
  • 2020-12-24 04:55

    I tried all the config's (proxy, registry, etc) nothing worked for me, so did a complete uninstall and install node & npm. Which helped to solve the issue.

    0 讨论(0)
  • 2020-12-24 05:00

    I know its just a workaround, but try using the build-in "Windows PowerShell"

    0 讨论(0)
  • 2020-12-24 05:01

    I just went through a rabbit hole trying to identify the issue. If npm install keeps getting bottlenecked you should heavily consider modifying the properties of your virtual ethernet and disable all of the offload items.

    I had 0 proxies or caching issues with npm.

    See here for the tutorial on how to get to the menu and disable your offload settings. Make sure you do this for both your your ethernet and VEthernet and you should immediately notice a difference. I went from a 10 minute hanging resolution that sometimes just stopped down to 10 seconds installs. https://www.dincloud.com/blog/tuning-windows-get-15x-speeds-on-large-file-copies-today

    0 讨论(0)
  • 2020-12-24 05:05

    Disclaimer. Concerns regarding security: hopefully you know what you download to your node_modules folder, do you ;)

    From eternity → to 5 seconds builds:

    • search for Windows Defender settings
    • → Virus & threat protection
    • → Virus & threat protection Settings
    • → Exclusions

    here add this two paths to your list of excluded realtime protection folders:

    C:\Program Files\nodejs
    C:\Users\<your username>\AppData\Roaming\npm
    

    PS: replace the <your username> with your respective User folder name.
    If you're wandering why you can't find the AppData folder in Explorer, make sure to check View options for hidden folders.

    0 讨论(0)
  • 2020-12-24 05:11

    For me it appeared to be a problem with IPv6.

    Disabling IPv6 helped immensely for me.
    With IPv6 turned on "update-package newtonsoft.json" took 1:45 to time out with the error "update-package : A task was canceled."

    With IPv6 disabled "update-package newtonsoft.json" completed in 10 seconds

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