npm install hangs in high packet loss situations #4629

kethinov opened this Issue Feb 8, 2014 · 3 comments


None yet
4 participants

kethinov commented Feb 8, 2014

If you're at an airport, or any other location where the internet connection is pretty lousy, it's almost impossible to successfully complete an npm install for any app with a substantial number of dependencies.

Basically what happens is things hum along fine for a while...

http GET
info trying registry request attempt 1 at 13:54:46
http GET
http 304
http 304
http 304

But then it just... stops. You can wait hours and it just sits there hanging on that last attempt to fetch debuglog, or whatever module it randomly stopped on.

Also from what I can tell there's no way to do this incrementally. When you Ctrl+C the process and run npm install again, there is no output. It doesn't pick up from where it left off, it doesn't even start over. It just does nothing. You have to manually rm -rf the node_modules folder and re-run the npm install command to start over.

And of course, starting it over again only results in it just getting hung up on some other random module it tries to fetch.

I'm not too familiar with npm's internals, but shouldn't it be possible to add some kind of request timeout when fetching modules so if there's a packet loss scenario it can fail fast and retry?


rlidwka commented Feb 9, 2014

When you Ctrl+C the process and run npm install again, there is no output.

It's a bug with locks, confirmed. You can remove npm cache to proceed.

othiym23 added the support label Sep 26, 2014


smikes commented Jan 6, 2015

@kethinov, Is this still a problem for you?

Now that the registry is more stable and npm has been rewritten to use fewer locks internally, I would guess that you run into it less often.

There have been a lot of improvements to npm -- especially around conflicts and race conditions during install -- since Feb 2014. Can you try updating your npm installation?

To update npm, run npm -g install npm@latest

We are trying to clean up older npm issues, so if we don't hear back from you within a week, we will close this issue. (Don't worry -- you can always come back again and open a new issue!)



othiym23 commented Jan 15, 2015

  1. The installer has improved substantially at dealing with spotty connections since last February.
  2. The registry is considerably less delicate a flower than it once was.
  3. npm@3 (coming soon(tm)) has a much more forgiving attitude towards being interrupted, because of the way it figures out the state of the whole tree rather than making assumptions about the state of the installation based on looking at top-level installed dependencies.

So I'm gonna call this one resolved -- if not right now, then very soon -- and am going to close it as such.

othiym23 closed this Jan 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment