Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm install started to hang on "still idealTree buildDeps" for 60 seconds if there are dependencies pointing to specific gitlab repository url (a regression compared to npm v6) #3359

Open
1 task done
klesun opened this issue Jun 3, 2021 · 74 comments
Labels
Bug thing that needs fixing cmd:install related to `npm install` Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release Release 8.x work is associated with a specific npm 8 release

Comments

@klesun
Copy link

klesun commented Jun 3, 2021

Is there an existing issue for this?

  • I have searched the existing issues

See #1991 (comment)

Current Behavior

npm install in a fresh project with an explicit git+ssh dependency on a gitlab repo (minimal example) takes 60+ seconds, seemingly it waits for some random network timeout before proceeding the installation.

Expected Behavior

npm install should take 2-3 seconds to install dependencies of the project in minimal example like it did in npm v6.

Steps To Reproduce

See https://gitlab.com/klesun/npm-seven-issue

I reproduced this hang in Ubuntu 20.04 with npm 7.15.1 as well as MacBook Pro 2019 with npm 7.15.1

git clone https://gitlab.com/klesun/npm-seven-issue.git
cd npm-seven-issue
npm install

package.json

{
  "name": "npm-seven-issue",
  "version": "0.0.1",
  "devDependencies": {
    "npm-seven-issue-dep": "git+ssh://git@gitlab.com/klesun/npm-seven-issue-dep#5f1b313978986974d4364585e6bd3689276f1697"
  }
}

If you are using npm version prior to v7.x, for example v6.14.13, npm install should be done within 2-3 seconds.

If you are using npm version v7.0.0 or later, for example 7.15.1, npm install will hang for 60+ seconds with following text:

[....................] \ idealTree.pql-box: still idealTree buildDeps

Note, you need to remove package-lock.json and node_modules prior to retrying the npm install, otherwise issue won't reproduce.

Environment

  • OS: Ubuntu 20.04
  • Node: v16.2.0
  • npm: 7.15.1

as well as

  • OS: MacBook Pro 2019
  • Node: v15.11.0
  • npm: 7.15.1
@klesun klesun added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Jun 3, 2021
@ljharb
Copy link
Collaborator

ljharb commented Jun 3, 2021

What happens with npm 7 latest? (v7.6 is pretty old at this point)

@klesun
Copy link
Author

klesun commented Jun 3, 2021

Like with ubuntu, when I update npm on my macbook to @latest (7.15.1) I also get the 60+ seconds hang:

klesun@klesuns-MacBook-Pro npm-seven-issue % /usr/bin/time npm install
added 1 package, and audited 2 packages in 1m
found 0 vulnerabilities
       72.94 real         1.45 user         0.26 sys
klesun@klesuns-MacBook-Pro npm-seven-issue % npm -v
7.15.1

Updated npm version in description

@klesun klesun closed this as completed Jun 3, 2021
@klesun klesun reopened this Jun 3, 2021
@klesun
Copy link
Author

klesun commented Jun 4, 2021

btw, latest yarn (1.22.10) has no such issues, only 7th npm has

@cronvel
Copy link

cronvel commented Jun 5, 2021

npm 7.15.1 here, it's been a week now that this bug cause troubles. On my end it either hangs on "idealTree" or "reify". It seems to stall forever (or at least 5 min). Sometime retrying multiple times do it, but sometime not. I was suspecting some registry issue/lag at first, but yarn has no issue.

@klesun klesun changed the title [BUG] npm install hangs on "still idealTree buildDeps" for 60 seconds if there are dependencies pointing to specific gitlab repository url (a regression compared to npm v6) [BUG] npm install started to hang on "still idealTree buildDeps" for 60 seconds if there are dependencies pointing to specific gitlab repository url (a regression compared to npm v6) Jun 5, 2021
@midudev
Copy link

midudev commented Jun 10, 2021

I think it's related to this: #3257

@midudev
Copy link

midudev commented Jun 10, 2021

You could try to execute this using DEBUG=* npm install so more output could be provided. :)

@bperel
Copy link

bperel commented Jul 1, 2021

@midudev Here's the output that I have, after that NPM seems to hang forever. The only thing that I did before running the command was adding "playwright": "^1.12" in the dev dependencies of package.json.

I have Node v12.22.1 and NPM 7.14.0

Output

``` $ DEBUG=* npm install agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +1s agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +57ms1.0.0 want: ^1.12 agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 1) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +2ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 2) free +114mswant: ^1.12 agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +228mswant: ^1.12 agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +13ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +4ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +3ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +7ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +11ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 2) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +1ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 1) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +1ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 1) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 2) free +192ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 2) free +11ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 3) free +4ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +9ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 1) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 2) free +187ms10.0 agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +9mswant: ~1.1.0 agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 1) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 2) free +142ms1.1.0 agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +81ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 1) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 2, finished: 2) free +1s agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +6ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 2) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +2ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 2) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +1ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 3) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 3) free +398ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 4) free +30ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 3) free +63ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +6ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 2) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 3) free +230ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +6ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 2) reuse on addRequest, timeout 300001ms +1ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 3) free +320ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +8ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 2) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 3, finished: 3) free +632ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +7ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 3) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 4) free +508ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +9ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 4) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 5) free +80ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +5ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 3) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 4) free +79ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +8ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 3) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 4) free +68ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +7ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 3) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 4) free +111ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +7ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 3) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 4, finished: 4) free +126ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +8ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 4) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 5) free +149ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +27ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 5) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) free +108ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +41ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 4) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +1ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 4) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +1ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 4) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +0ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 4) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +2ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 5) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +1ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 7, finished: 6) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[6#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[7#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +2ms agentkeepalive sock[8#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[9#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[10#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[11#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[12#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[13#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[14#registry.npmjs.org:443::::::::true::::::::::] create, timeout 300001ms +1ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 5) free +177ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 5) will be reuse on agent free event +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 7, finished: 7) free +2ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 8, finished: 7) will be reuse on agent free event +0ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 5) free +13ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 5) will be reuse on agent free event +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) free +1ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 7, finished: 6) will be reuse on agent free event +0ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 5) free +61ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 5) will be reuse on agent free event +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 8, finished: 8) free +68ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 7, finished: 7) free +31ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) free +89ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 5) free +7ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) free +7ms agentkeepalive sock[10#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +49ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) free +2ms agentkeepalive sock[13#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +80ms agentkeepalive sock[11#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +71ms agentkeepalive sock[12#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +17ms agentkeepalive sock[6#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +22ms agentkeepalive sock[9#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +57ms agentkeepalive sock[8#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +50ms agentkeepalive sock[14#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +1ms agentkeepalive sock[7#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) free +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +15ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 9, finished: 8) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::] reset timeout to 300001ms +1ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 8, finished: 7) reuse on addRequest, timeout 300001ms +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 8, finished: 8) free +293ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 9, finished: 9) free +2ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +14s agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[1#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) close, isError: false +1ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 5) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +5ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[5#registry.npmjs.org:443::::::::true::::::::::](requests: 5, finished: 5) close, isError: false +0ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +7ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[3#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) close, isError: false +0ms agentkeepalive sock[10#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +50ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[10#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[10#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +0ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +1ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[2#registry.npmjs.org:443::::::::true::::::::::](requests: 6, finished: 6) close, isError: false +1ms agentkeepalive sock[13#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +79ms agentkeepalive timeout listeners: onTimeout, onTimeout +1ms agentkeepalive sock[13#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[13#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +0ms agentkeepalive sock[11#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +70ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[11#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[11#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +0ms agentkeepalive sock[12#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +17ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[12#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[12#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +0ms agentkeepalive sock[6#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +22ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[6#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[6#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +0ms agentkeepalive sock[9#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +58ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[9#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[9#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +1ms agentkeepalive sock[8#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +49ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[8#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +1ms agentkeepalive sock[8#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +0ms agentkeepalive sock[14#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +0ms agentkeepalive timeout listeners: onTimeout, onTimeout +1ms agentkeepalive sock[14#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[7#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +0ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[7#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +1ms agentkeepalive sock[7#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +0ms agentkeepalive sock[14#registry.npmjs.org:443::::::::true::::::::::](requests: 1, finished: 1) close, isError: false +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 8, finished: 8) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +306ms agentkeepalive timeout listeners: onTimeout, onTimeout +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[4#registry.npmjs.org:443::::::::true::::::::::](requests: 8, finished: 8) close, isError: false +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 9, finished: 9) timeout after 15000ms, listeners 2, defaultTimeoutListenerCount 2, hasHttpRequest false, HttpRequest timeoutListenerCount 0 +1ms agentkeepalive timeout listeners: onTimeout, onTimeout +1ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::] is free, destroy quietly +0ms agentkeepalive sock[0#registry.npmjs.org:443::::::::true::::::::::](requests: 9, finished: 9) close, isError: false +0ms [ ] \ reify:playwright: timing reifyNode:node_modules/pngjs Completed in 82ms

</p>
</details>

@ljharb
Copy link
Collaborator

ljharb commented Jul 1, 2021

@bperel can you try it with v7.19.1?

@bperel
Copy link

bperel commented Jul 2, 2021

@bperel can you try it with v7.19.1?

It seems to work with 7.19.1

@ljharb
Copy link
Collaborator

ljharb commented Jul 2, 2021

@klesun @cronvel @midudev can you also try with npm v7.19.1?

@klesun
Copy link
Author

klesun commented Jul 2, 2021

@ljharb tried again on same mac with v7.19.1 the minimal repro repo, but still getting the lag, 72.92 seconds:

klesun@artur gits % git clone https://gitlab.com/klesun/npm-seven-issue.git
klesun@artur gits % cd npm-seven-issue
klesun@artur npm-seven-issue % DEBUG=* /usr/bin/time npm install
  agentkeepalive sock[0#gitlab.com:443::::::::true:::::::::::::] create, timeout 300001ms +0ms
  agentkeepalive sock[0#gitlab.com:443::::::::true:::::::::::::](requests: 1, finished: 1) free +404ms
  agentkeepalive sock[0#gitlab.com:443::::::::true:::::::::::::] reset timeout to 300001ms +3ms
  agentkeepalive sock[0#gitlab.com:443::::::::true:::::::::::::](requests: 2, finished: 1) reuse on addRequest, timeout 300001ms +0ms
  agentkeepalive sock[0#gitlab.com:443::::::::true:::::::::::::](requests: 2, finished: 1) close, isError: false +29ms
  agentkeepalive sock[1#gitlab.com:443::::::::true:::::::::::::] create, timeout 300001ms +10s
  agentkeepalive sock[1#gitlab.com:443::::::::true:::::::::::::](requests: 1, finished: 0) close, isError: false +41ms
  agentkeepalive sock[2#gitlab.com:443::::::::true:::::::::::::] create, timeout 300001ms +1m
  agentkeepalive sock[2#gitlab.com:443::::::::true:::::::::::::](requests: 1, finished: 0) close, isError: false +48ms
  agentkeepalive sock[3#registry.npmjs.org:443::::::::true:::::::::::::] create, timeout 300001ms +2s
  agentkeepalive sock[3#registry.npmjs.org:443::::::::true:::::::::::::](requests: 1, finished: 1) free +400ms }

added 1 package, and audited 2 packages in 1m

found 0 vulnerabilities
       72.92 real         1.65 user         0.31 sys
klesun@artur npm-seven-issue % npm --version
7.19.1

@cronvel
Copy link

cronvel commented Jul 3, 2021

@ljharb It seems to work now, but the bug was not 100% reproducible on my end.

@ProfessorVarox
Copy link

I got the same problem, but it still occurs in npm v7.19.1

npm install --verbose log:

npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Users\\johannes\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'install',
npm verb cli   'twitch',
npm verb cli   'twitch-auth',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@7.19.1
npm info using node@v16.0.0
npm timing npm:load:whichnode Completed in 1ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:C:\Users\johannes\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 3ms
npm timing config:load:builtin Completed in 4ms
npm timing config:load:cli Completed in 3ms
npm timing config:load:env Completed in 1ms
npm timing config:load:file:D:\Projects\PanelWorker\.npmrc Completed in 0ms
npm timing config:load:project Completed in 1ms
npm timing config:load:file:C:\Users\johannes\.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:C:\Users\johannes\AppData\Roaming\npm\etc\npmrc Completed in 0ms
npm timing config:load:global Completed in 1ms
npm timing config:load:validate Completed in 1ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 15ms
npm timing npm:load:configload Completed in 15ms
npm timing npm:load:setTitle Completed in 0ms
npm timing npm:load:setupLog Completed in 2ms
npm timing npm:load:cleanupLog Completed in 3ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load:projectScope Completed in 2ms
npm timing npm:load Completed in 51ms
npm timing config:load:flatten Completed in 5ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 88ms
npm timing idealTree:userRequests Completed in 3ms
npm verb shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules
npm http fetch GET 200 https://registry.npmjs.org/twitch 136ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/twitch-auth 192ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@d-fischer%2fcache-decorators 46ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/tslib 44ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/twitch-api-call 135ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/top-package 145ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/twitch-common 155ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@d-fischer%2fdeprecate 858ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@d-fischer%2flogger 868ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@d-fischer%2frate-limiter 884ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@d-fischer%2fshared-utils 999ms (cache revalidated)
npm timing idealTree:#root Completed in 1347ms
npm http fetch GET 200 https://registry.npmjs.org/detect-node 69ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/node-fetch 75ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@types%2fnode 87ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@types%2fnode-fetch 161ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@d-fischer%2fpromise.allsettled 1531ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@d-fischer%2fqs 1548ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@d-fischer%2fcross-fetch 1756ms (cache revalidated)
npm timing idealTree:node_modules/twitch Completed in 1773ms
npm timing idealTree:node_modules/@d-fischer/cache-decorators Completed in 2ms
npm timing idealTree:node_modules/@d-fischer/deprecate Completed in 0ms
npm timing idealTree:node_modules/@d-fischer/logger Completed in 1ms
npm http fetch GET 200 https://registry.npmjs.org/es-abstract 69ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/array.prototype.map 72ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/define-properties 74ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/iterate-value 77ms (cache revalidated)
npm timing idealTree:node_modules/@d-fischer/rate-limiter Completed in 84ms
npm http fetch GET 200 https://registry.npmjs.org/function-bind 119ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-string 130ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/es-to-primitive 134ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/es-array-method-boxes-properly 140ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/get-intrinsic 136ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/call-bind 144ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/has 138ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/object.assign 152ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/string.prototype.trimend 155ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/iterate-iterator 155ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/es-get-iterator 157ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-regex 186ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/has-symbols 191ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-callable 191ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/object-inspect 199ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-negative-zero 203ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/unbox-primitive 201ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/string.prototype.trimstart 205ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/object-keys 222ms (cache revalidated)
npm timing idealTree:node_modules/@d-fischer/promise.allsettled Completed in 233ms
npm timing idealTree:node_modules/@d-fischer/shared-utils Completed in 0ms
npm timing idealTree:node_modules/@types/node Completed in 0ms
npm timing idealTree:node_modules/array.prototype.map Completed in 3ms
npm timing idealTree:node_modules/call-bind Completed in 2ms
npm timing idealTree:node_modules/define-properties Completed in 1ms
npm timing idealTree:node_modules/detect-node Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/which-boxed-primitive 57ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-date-object 65ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/has-bigints 69ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-symbol 78ms (cache revalidated)
npm timing idealTree:node_modules/es-abstract Completed in 89ms
npm timing idealTree:node_modules/es-array-method-boxes-properly Completed in 0ms
npm timing idealTree:node_modules/es-to-primitive Completed in 2ms
npm timing idealTree:node_modules/function-bind Completed in 0ms
npm timing idealTree:node_modules/get-intrinsic Completed in 0ms
npm timing idealTree:node_modules/has Completed in 0ms
npm timing idealTree:node_modules/has-symbols Completed in 0ms
npm timing idealTree:node_modules/is-callable Completed in 0ms
npm timing idealTree:node_modules/is-date-object Completed in 0ms
npm timing idealTree:node_modules/is-negative-zero Completed in 0ms
npm timing idealTree:node_modules/is-regex Completed in 0ms
npm timing idealTree:node_modules/is-string Completed in 0ms
npm timing idealTree:node_modules/is-symbol Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/is-set 63ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-arguments 76ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/isarray 75ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-map 78ms (cache revalidated)
npm timing idealTree:node_modules/iterate-value Completed in 83ms
npm timing idealTree:node_modules/es-get-iterator Completed in 7ms
npm timing idealTree:node_modules/is-arguments Completed in 0ms
npm timing idealTree:node_modules/is-map Completed in 0ms
npm timing idealTree:node_modules/is-set Completed in 0ms
npm timing idealTree:node_modules/iterate-iterator Completed in 0ms
npm timing idealTree:node_modules/object-inspect Completed in 0ms
npm timing idealTree:node_modules/object-keys Completed in 0ms
npm timing idealTree:node_modules/object.assign Completed in 0ms
npm timing idealTree:node_modules/string.prototype.trimend Completed in 0ms
npm timing idealTree:node_modules/string.prototype.trimstart Completed in 0ms
npm timing idealTree:node_modules/top-package Completed in 0ms
npm timing idealTree:node_modules/tslib Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/form-data 54ms (cache revalidated)
npm timing idealTree:node_modules/twitch-api-call Completed in 62ms
npm timing idealTree:node_modules/@d-fischer/cross-fetch Completed in 0ms
npm timing idealTree:node_modules/@d-fischer/qs Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/asynckit 48ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/combined-stream 64ms (cache revalidated)
npm timing idealTree:node_modules/@types/node-fetch Completed in 67ms
npm http fetch GET 200 https://registry.npmjs.org/delayed-stream 49ms (cache revalidated)
npm timing idealTree:node_modules/form-data Completed in 55ms
npm timing idealTree:node_modules/asynckit Completed in 0ms
npm timing idealTree:node_modules/combined-stream Completed in 2ms
npm timing idealTree:node_modules/delayed-stream Completed in 0ms
npm timing idealTree:node_modules/node-fetch Completed in 0ms
npm timing idealTree:node_modules/twitch-auth Completed in 0ms
npm timing idealTree:node_modules/twitch-common Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/is-number-object 65ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-boolean-object 68ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-bigint 89ms (cache revalidated)
npm timing idealTree:node_modules/unbox-primitive Completed in 93ms
npm timing idealTree:node_modules/has-bigints Completed in 0ms
npm timing idealTree:node_modules/which-boxed-primitive Completed in 2ms
npm timing idealTree:node_modules/is-bigint Completed in 0ms
npm timing idealTree:node_modules/is-boolean-object Completed in 0ms
npm timing idealTree:node_modules/is-number-object Completed in 0ms
npm timing idealTree:node_modules/@d-fischer/rate-limiter/node_modules/@types/node Completed in 0ms
npm timing idealTree:node_modules/es-get-iterator/node_modules/isarray Completed in 0ms
npm timing idealTree:buildDeps Completed in 3992ms
npm timing idealTree:fixDepFlags Completed in 3ms
npm timing idealTree Completed in 4094ms
npm timing reify:loadTrees Completed in 4095ms
npm timing reify:diffTrees Completed in 7ms
[         .........] / idealTree: timing reify:diffTrees Completed in 7ms

It freezes at this point and I am not able to close the cmd.exe window anymore

@mogarick
Copy link

Is there a workaround for this problem?
I'm on npm 7.20.1 an the I try npm i when my package.json includes a gutbucket repo with git+ssh it hangs. this is the trace output in my case:

npm i --verbose        
npm verb cli [
npm verb cli   '/Users/mogarick/n/bin/node',
npm verb cli   '/Users/mogarick/n/bin/npm',
npm verb cli   'i',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@7.20.1
npm info using node@v14.17.3
npm timing npm:load:whichnode Completed in 1ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/Users/mogarick/n/lib/node_modules/npm/npmrc Completed in 2ms
npm timing config:load:builtin Completed in 2ms
npm timing config:load:cli Completed in 3ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:/Users/mogarick/code/juicy-rn/.npmrc Completed in 0ms
npm timing config:load:project Completed in 1ms
npm timing config:load:file:/Users/mogarick/.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:/Users/mogarick/n/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 10ms
npm timing npm:load:configload Completed in 10ms
npm timing npm:load:setTitle Completed in 18ms
npm timing npm:load:setupLog Completed in 0ms
npm timing config:load:flatten Completed in 2ms
npm timing npm:load:cleanupLog Completed in 2ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load:projectScope Completed in 1ms
npm timing npm:load Completed in 38ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 830ms
npm timing idealTree:userRequests Completed in 0ms
npm timing arborist:ctor Completed in 0ms

@metaturso
Copy link

metaturso commented Aug 10, 2021

Same issue for me on NPM 7.20.5 running on a dated version of NodeJS. Oddly enough, the install succeeds only if I run npm in --verbose mode.

@RichGod93
Copy link

thanks a lot, this really helped me with the problem i had

@illume
Copy link

illume commented Sep 21, 2021

Getting a hang with npm@7.24.0 also.

When I run it like npm install --no-progress --verbose --loglevel silly I can see the same log lines repeating over and over. This shows to me there is a loop. Node crashes with a gc error on low-ish memory systems.

Not sure if this is the same issue, but I saw a related issue here: #3208

ED: One work around was to use a npmv6 generated package-lock.json file, then the install finished running.

@gh-andre
Copy link

I'm seeing the same on CentOS, npm v7.24.0. Hangs forever on idealTree buildDeps.

sudo npm install --verbose -g pm2
npm verb cli [ '/usr/bin/node', '/bin/npm', 'install', '--verbose', '-g', 'pm2' ]
npm info using npm@7.24.0
npm info using node@v16.10.0
...
npm timing npm:load Completed in 46ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 8ms
npm timing idealTree:userRequests Completed in 3ms
⸨⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⸩ ⠹ idealTree:lib: sill idealTree buildDeps

@akyoto
Copy link

akyoto commented Nov 23, 2021

npm v8.1.3 on Arch Linux also hangs forever on idealTree buildDeps when trying to install typescript.

@gh-andre
Copy link

I profiled npm while it was sitting on npm install lodash for 2 minutes and all it did was trying to write and update the gauge for about 5-8 seconds at a time. Not a single read. For somebody familiar with the code it should be trivial to identify what's going on - just attach a debugger and there it is.

npm-writing-indefinitely

@gh-andre
Copy link

I figured out why npm is hanging in the case described in my comment above. Maybe this will help others identify similar issues.

Basically, npm hangs silently for about 7 minutes (default configuration) if it cannot connect to registry.npmjs.org. In my case, this will happen for any VM created in AWS, in region us-west-2. Other regions, such as us-west-1 and use-east-1, work fine. You can test if that's what's going on in your environment with curl like this.

curl --connect-timeout 15 https://registry.npmjs.org

In a working environment you will get a JSON response right away and in an environment where it cannot connect to the npm registry, it will hang for 15 seconds and report a connection error.

I admire npm's resiliency in trying to install packages, but I wish it would report retries immediately, instead of waiting until it gives up entirely in 7 minutes, even with verbose output.

@MJ9001
Copy link

MJ9001 commented Jan 12, 2022

Having the same issue on ArchLinux. Here's my output when running npm update -g --verbose

npm verb cli [ '/usr/bin/node', '/usr/bin/npm', 'update', '-g', '--verbose' ]
npm info using npm@8.3.0
npm info using node@v17.3.0
npm timing npm:load:whichnode Completed in 0ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 0ms
npm timing config:load:builtin Completed in 0ms
npm timing config:load:cli Completed in 1ms
npm timing config:load:env Completed in 1ms
npm timing config:load:project Completed in 0ms
npm timing config:load:file:/home/lucky/.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:/usr/etc/npmrc Completed in 1ms
npm timing config:load:global Completed in 1ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 0ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 7ms
npm timing npm:load:configload Completed in 7ms
npm timing npm:load:setTitle Completed in 0ms
npm timing config:load:flatten Completed in 1ms
npm timing npm:load:display Completed in 4ms
npm verb logfile /home/lucky/.npm/_logs/2022-01-12T04_05_08_729Z-debug-0.log
npm timing npm:load:logFile Completed in 2ms
npm timing npm:load:timers Completed in 0ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 14ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 2ms
npm timing idealTree:userRequests Completed in 0ms
(( )) | idealTree:lib: sill idealTree buildDeps

@Bschitter
Copy link

disabling ipv6 on my main NIC fixed npm install for Ubuntu 22.04 under WSL1

Thank you so much!

disabling ipv6 for my wireless connection solved my issue on Manjaro 21.3.7 with npm 8.17.0 and nodejs 18.7.0

@ebaizel
Copy link

ebaizel commented Sep 15, 2022

Works on MacOS if I set IPV6 to Link-local (from Automatically). Thanks for the help.

@ramu2514
Copy link

Works on MacOS if I set IPV6 to Link-local (from Automatically). Thanks for the help.

This worked. BTW, what is the root cause?

@oscrx
Copy link

oscrx commented Nov 13, 2022

In some cases the cause of this issue seems to be a misconfiguration of IPv6 on the client side.

There is no happy eyeballs implemented in npm it seems, if the system thinks it can use IPv6 it will. If IPv6 is not functional there is no fallback, unfortunately.

Try pinging an IPv6 website to validate if your config is working

ping6 google.com
ping -6 google.com

@jordanliu
Copy link

jordanliu commented Nov 15, 2022

Works on MacOS if I set IPV6 to Link-local (from Automatically). Thanks for the help.

This fixed it for me as well, using azure npm registry

@peter65374
Copy link

I have get same experience still idealTree buildDeps when npm install command. so I changed npm refer registry URL for workaround then successfully installed module via npm install.

$ npm config set registry https://registry.npm.taobao.org
$ npm config get registry

Cool, that works for me. BTW, the mirror https://registry.npm.taobao.org DNS solved to http://registry.npmmirror.com since 2022.6.30. So change the command to

npm config set registry http://registry.npmmirror.com

@AnnieTaylorCHEN
Copy link

AnnieTaylorCHEN commented Dec 1, 2022

Works on MacOS if I set IPV6 to Link-local (from Automatically). Thanks for the help.

Hi, I am on Mac M2 Ventura 13.0.1 (22A400), where can I find the above settings? I am not sure whether this is the root cause, as everything worked fine until today.

Node v18.12.1 npm 8.19.2

--- UPDATE:

Alright, I found where it is on M2:
Go to System Settings > Network > Wifi (if using) > Click on the connected ones, details > TCP/IC > Configure IPv6 from Automatically to Link-Local Only

After that I tried npm i again and this time it worked!

@AnnieTaylorCHEN
Copy link

Can someone enlighten me what is causing this issue?

  • is it npm registry?
  • is it Mac?
  • is it gitlab?

Why would the above solution solve the problem? Just curious.

@oscrx
Copy link

oscrx commented Dec 2, 2022

In my case my ipv6 was broken, restarted my router and it was fixed.

There is no fallback to ipv4 build in.

@gh-andre
Copy link

gh-andre commented Dec 2, 2022

@AnnieTaylorCHEN

Can someone enlighten me what is causing this issue?

There's a lot of comments that suggest changing networking configuration, such as disabling IPv6 or even SSL certificate validation. These sound to me like that are just highlighting the real problem, which is that npm sits there for 7 minutes, by default, with no feedback as to what's going on.

npm should provide some visible feedback in a few seconds that it cannot reach the registry, so people can troubleshoot networking.

A quick test for me whether this issue can be reproduced was to run this command and see if it times out in 15 seconds. If it does, there's something in the networking that needs to be looked into.

curl --connect-timeout 15 https://registry.npmjs.org

My guess from all the comments (I didn't debug it) is that npm binds to any network interface, so IPv6 gets in the way. It would be good if npm provided a way to select an interface, like curl does, similar to this:

curl --interface 12.34.56.78 --connect-timeout 15 https://registry.npmjs.org

@isabelroman84
Copy link

Hello. I use Windows. In my case, I installed the most recent version of the OS and ran npm install again. At that moment the firewall appeared, I gave it the permission and got the installation immediately.

@Slynchy
Copy link

Slynchy commented Jan 2, 2023

I also recently reinstalled the latest Windows 10 version, and encountered this issue (with firewall entirely disabled). It was indeed related to the system believing IPv6 was enabled/available, when it actually was not. This webpage describes the process for disabling IPv6 on Windows, if anyone else needs to fix the issue in a hurry, but note that this is not a solution; addressing why IPv6 is not working on your machine would be the better option.

@oscrx
Copy link

oscrx commented Jan 2, 2023

Beware that fully disabling ipv6 on Windows might impact the correct functioning of windows itself
https://www.sidn.nl/en/news-and-blogs/dont-disable-ipv6
Microsoft recommends to prefer ipv4 over ipv6 instead.

In this case a fallback should be build in npm to fallback on ipv4.

@GoodBoyNinja
Copy link

My my M1 MacBook Pro this solved it:

  1. Go to System Settings, search for IPv6, set Configure IPv6 to Link-Local Only
  2. From Finder, choose Go -> Go to Folder and type in .npm, it should be stored in your user folder. Delete it.

Note that I am not certain that setting IPv6 was part of the solution, but now everything works

@walrus811
Copy link

walrus811 commented Feb 14, 2023

I'm using M2 MacBook Air. It seems to be related to the connected network. @GoodBoyNinja's solution doesn't work for me.

However, after I changed my WiFi provider from a cafe's to the hotspot of my iPhone, it works well now.

@kurbus
Copy link

kurbus commented Feb 24, 2023

I prefer to think of this as an "NPM thing." Deus ex machina in reverse.

@nathan130200
Copy link

nathan130200 commented Mar 14, 2023

An tip for all, make sure the folder you is in, you have right permissions. I had same issue when i was attempt to install some modules inside Documents folder eg: Documents\test-project i tried both NPM and Yarn and two both stuck in same place (yarn stuck on linking dependencies). Then i moved that folder to desktop and fixed. I'm trying to figure how (in my case windows) is blocking my documents folder.

UPDATE In my case was blocked by Windows Defender Ransomware Protection, in "Controlled Folder Access" section. Block any 3rd party app modify Documents, Pictures, Movies and Downloads folder. There two options to solve this:

  1. Disable ransomware protection (idk if will have a huge impact)
  2. Add some applications (such node, yarn) to "Controlled Access Folder" exclusion list

@PhilETaylor
Copy link

ok I'll chime in...

Dual stack ip4 and IPv6 on latest MacOS Mac Studio with 128Mb RAM on 1Gbps fibre connection to the desk. both ip4 and ipv6 are valid and work perfectly all the time during the day with anything non-npm like

Dual stack ip4 and IPv6. = npm hangs 100% of the time.

Disable IPv6 and use ip4 only = npm works 100% of the time.

As soon as I disable ipv6 I can 100% of the time get npm upgrade to complete.

As soon as I enable ipv6 (dual stack with ip4 as is the norm) then 100% of the time npm upgrade stalls/hangs...

@louisblythe
Copy link

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

I have changed to a starlink at a friends place away from the iinet broadband at home and cant get it to work! Maddening

@KruemelopmentDev
Copy link

still doesnt work for me.
[#########.........] - idealTree: timing idealTree Completed in 2572ms
it get stuck here, i tried everything that I found online but nothing worked.

@gh-andre
Copy link

@KruemelopmentDev

Check if you connect to the registry via curl, as described here. If you cannot, then it's a networking issue and npm just isn't doing a good job at detecting or reporting it.

#3359 (comment)

@chriseborowski
Copy link

still doesnt work for me. [#########.........] - idealTree: timing idealTree Completed in 2572ms it get stuck here, i tried everything that I found online but nothing worked.

Try disconnecting and reconnecting to the internet. Not sure why but I had this problem a few times only today, and it does help.

@AquiGorka
Copy link

AquiGorka commented Aug 4, 2023

I can confirm this is not an npm issue but rather a node fetch issue - I confirmed by running a simple node script:

const run=async()=>{
  console.log(await fetch(URL).then(r=>r.json()))
}
run()

any time I noticed the npm i lag and the node fetch consistently timed out.

For me, in macOS the proposed solution to locally link ipv6 worked

@oscrx
Copy link

oscrx commented Aug 4, 2023

There seems to be a happy eyeballs implementation in node
nodejs/node#44731

@ramlakhan79
Copy link

re: sill placeDep ROOT semver@7.5.4 O[#########.........] / idealTree:@babel/core: sill placeDep ROOT semver@7.5.4 O[#########.........] / idea
npm ERR! code ECONNRESET
npm ERR! syscall read
npm ERR! errno ECONNRESET
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/@typescript-eslint%2feslint-plugin: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache_logs\2023-09-11T16_23_22_127Z-debug-0.log

Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json
Deleting myapp/ from E:\HTML YT\HTML\React js
Done.

How to solve this error

@hungdev
Copy link

hungdev commented Jan 26, 2024

Works on MacOS if I set IPV6 to Link-local (from Automatically). Thanks for the help.

Hi, I am on Mac M2 Ventura 13.0.1 (22A400), where can I find the above settings? I am not sure whether this is the root cause, as everything worked fine until today.

Node v18.12.1 npm 8.19.2

--- UPDATE:

Alright, I found where it is on M2: Go to System Settings > Network > Wifi (if using) > Click on the connected ones, details > TCP/IC > Configure IPv6 from Automatically to Link-Local Only

After that I tried npm i again and this time it worked!

thank you for your guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing cmd:install related to `npm install` Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests