super slow node npm commands

Viewed 14055

I have node v.4.4 with npm v.2.14.20 (default bundled with windows installer). My OS: Windows 7 64bit. Hardware: Dell laptop, 16GB RAM, SSD, core i7.

I'm facing a problem with extremely slow npm. For example when I want to check version of node with

node --version
v4.4.0

I receive output 4.4.0 within miliseconds. But when I type

npm --version

I need to wait ridiculous 8-15 seconds to receive an output! And it's the same with every single npm command.

What i tried: update npm (to most recent 3.x version), update node to 5.9.0, i also tried my luck with x86 versions - same thing.

  1. Any clues what can cause such "sleep" (it's only with npm, every other cmd command works fine, system works fine)?
  2. I will appreciate any tips how I can debug this thing to see what's going on under the hood
6 Answers

I had similar problems regarding npm being slow. Ive researched for hours on possible solutions. The only solutions that worked for me was either disabling the progress bar with npm config set progress false --global Or using a different terminal such as git bash or windows terminal.

Disable Firewall / Antivirus

If your machine belongs to a company, it may contain firewall / antivirus which delay every command in the command line.

I faced the same issue when every git command took 10+ seconds.

When trying to diagnose the problem with the IT department, we saw that when disabling firewall / antivirus in Windows 7, everything works much faster (as it should).

Upgrade to Node15

It's the latest stable version of NodeJs. Node comes with Npm so you will get the latest Npm as well automatically.

Following Seth Holladay answer but with solution to Windows

Go to my computer
Right click on my computer and select properties at the bottom
Look at the left labels, click on the additional system parameters
Click environment variables at the bottom
Here you can change user env variables at the top and system wide env variables at the bottom

Related