Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

npm install hangs in high packet loss situations #4629

Closed
kethinov opened this Issue · 3 comments

4 participants

@kethinov

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...

[snip]
http GET https://registry.npmjs.org/core-util-is
info trying registry request attempt 1 at 13:54:46
http GET https://registry.npmjs.org/debuglog/0.0.2
http 304 https://registry.npmjs.org/delayed-stream/0.0.5
http 304 https://registry.npmjs.org/core-util-is
http 304 https://registry.npmjs.org/debuglog/0.0.2

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

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 othiym23 added the support label
@smikes

@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!)

Thanks!

@othiym23
Owner
  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 othiym23 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.