this will allow npm download and cache dependencies in the directory you specified.
3) another solution for caching npm packages dependencies is npm lazy, you may find more information about this at npm Lazy website
Note: the caching process may or may not improve the download speed but it will probably save downloads time when installing or updating your npm packages.
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
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 ;-)
I faced the same issue while creating project while using angular cli "ng new PROJECT_NAME" this command triggers "npm -install" after creation of project, which took too long to install, and got stuck at "Installing packages for tooling via npm" . Follow these which worked for me
1) Check your npm version "npm --version" (must be higher than 2.1.8)Update your npm package by "npm -g install --save latest-version"
2) Remove the progress bar which consumes more time "npm set progress=false"
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.
PS: replace the <your username> with your respective User folder name; or use alias to the AppData folder like: %AppData%\npm
If you're wondering why you can't find the AppData folder in Explorer, make sure to check "View" options for "Show hidden folders".
Turning off the Windows Defender Firewall helped for me.
Because it just doesnt feel right I first added the WIFI to a Private Network (via WIFI settings) and only turned off the Windows Defender for a Private Network instead of all public Networks.
The next step should be: what network traffic causes this and how to add this to the Windows Defender exception rule :)
Make sure you really are using a recent version of npm. In my case C:\Program Files\nodejs\npm.cmd had been using an old npm-cli.js below the default prefix folder %appdata%\npm rather than a newer npm-cli.js below C:\Program Files\nodejs.
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
This is highly situational but we have a local registry (npm config get registry) that was not available (VPN:d) in when I was running the npm install ... and this obviously made it very slow but it still succeeded because everything was still available through cache.