Skip to content

[BUG] npm install gets stuck on 'idealTree:lib: sill idealTree buildDeps' #4309

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

Closed
2 tasks done
fwsmit opened this issue Jan 21, 2022 · 45 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@fwsmit
Copy link

fwsmit commented Jan 21, 2022

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When I run npm install in some repository, like https://github.com/mozilla/pdf.js, it gets stuck at the step: 'idealTree:lib: sill idealTree buildDeps'.

Other things like npm -g install don't work either.

Below is the verbose output and debug log attached.

npm-verbose.txt
2022-01-21T23_07_33_102Z-debug-0.log

Expected Behavior

It should install the neccesary packages

Steps To Reproduce

  1. run npm install -g gulp-cli (or any other package presumably)

Environment

  • npm: 8.3.2
  • Node.js: v17.3.0
  • OS Name: Arch Linux
  • System Model Name: Hp Zbook studio G5
  • npm config:

prefix = "/usr" 

; node bin location = /usr/bin/node
; cwd = /home/friso
; HOME = /home/friso
; Run `npm config ls -l` to show all defaults.

@fwsmit fwsmit added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Jan 21, 2022
@MatiasDuhalde
Copy link

MatiasDuhalde commented Feb 14, 2022

I have the same issue, when trying to install a package globally or locally. I am also running Arch Linux. The command eventually fails with ETIMEDOUT as follows:

npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/npm/-/npm-8.3.1.tgz failed, reason: connect ETIMEDOUT 2606:4700::6810:1923:443
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:
npm ERR!     /home/tracert6/.npm/_logs/2022-02-14T21_16_53_887Z-debug-0.log

The log suggests a problem trying to access https://registry.npmjs.org/npm/-/npm-8.3.1.tgz, but i have no problems accessing the URL from Firefox, or via curl. Also, I am not connected to a proxy, and I haven't changed npm's proxy-related config from its default value.

EDIT: I started tinkering with nvm and found out the following:

  • I tried with both node v17.0.0 with npm v8.1.0 and node v17.5.0 with npm v8.4.1, and neither worked.
  • I tried with node v16.14.0 (npm v8.3.1), and I had no problems running npm install

So, rolling back to v16 might work as a temporary solution, while the issue remains unresolved with node v17.

Environment

  • npm: 8.5.0
  • Node.js: v17.3.1
  • OS Name: Arch Linux 5.16.8-arch1-1
  • System Model Name: Intel i5-6400 (4) @ 3.300GHz
  • npm config:
; node bin location = /usr/bin/node
; cwd = /home/tracert6
; HOME = /home/tracert6
; Run `npm config ls -l` to show all defaults.

@nlf
Copy link
Contributor

nlf commented Mar 8, 2022

i think we need more information to reproduce this one. first off, can you give things a try with npm 8.5.3 and see if you still have problems?

if you do, can you share the package.json you're using? also, can you attempt to remove the node_modules and package-lock.json manually and try again?

@nlf
Copy link
Contributor

nlf commented Mar 8, 2022

@MatiasDuhalde your issue looks to be a problem with ipv6 as you have a timeout occurring during the socket connection. i've seen this happen myself on occasion and have raised the issue internally for investigation with the registry team. can you try running

curl https://registry.npmjs.org --resolve 'registry.npmjs.org:443:[2606:4700::6810:1923]'

and see if you get a response?

@MatiasDuhalde
Copy link

Hey @nlf ! Thanks for the reply!

Using npm 8.5.3 and node 17.6.0, I generated a new package.json file with npm init -y, and tried installing uuid. I got the same behavior as last time, command failed after some time, with the following error:

npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/uuid failed, reason: connect ETIMEDOUT 2606:4700::6810:1023:443
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:
npm ERR!     /home/tracert6/.npm/_logs/2022-03-08T21_28_27_148Z-debug-0.log

The complete log:

0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'uuid' ]
1 info using npm@8.5.3
2 info using node@v17.6.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/home/tracert6/Downloads/test/.npmrc Completed in 0ms
10 timing config:load:project Completed in 4ms
11 timing config:load:file:/home/tracert6/.npmrc Completed in 2ms
12 timing config:load:user Completed in 2ms
13 timing config:load:file:/usr/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 15ms
19 timing npm:load:configload Completed in 15ms
20 timing npm:load:setTitle Completed in 0ms
21 timing config:load:flatten Completed in 2ms
22 timing npm:load:display Completed in 4ms
23 verbose logfile /home/tracert6/.npm/_logs/2022-03-08T21_28_27_148Z-debug-0.log
24 timing npm:load:logFile Completed in 4ms
25 timing npm:load:timers Completed in 0ms
26 timing npm:load:configScope Completed in 0ms
27 timing npm:load Completed in 24ms
28 timing arborist:ctor Completed in 1ms
29 silly logfile start cleaning logs, removing 3 files
30 timing arborist:ctor Completed in 0ms
31 timing idealTree:init Completed in 12ms
32 timing idealTree:userRequests Completed in 2ms
33 silly idealTree buildDeps
34 silly fetch manifest uuid@*
35 silly placeDep ROOT uuid@ OK for: test@1.0.0 want: *
36 timing idealTree:#root Completed in 459704ms
37 timing idealTree:node_modules/uuid Completed in 0ms
38 timing idealTree:buildDeps Completed in 459706ms
39 timing idealTree:fixDepFlags Completed in 0ms
40 timing idealTree Completed in 459721ms
41 timing command:install Completed in 459733ms
42 verbose type system
43 verbose stack FetchError: request to https://registry.npmjs.org/uuid failed, reason: connect ETIMEDOUT 2606:4700::6810:1023:443
43 verbose stack     at ClientRequest.<anonymous> (/usr/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
43 verbose stack     at ClientRequest.emit (node:events:527:28)
43 verbose stack     at TLSSocket.socketErrorListener (node:_http_client:442:9)
43 verbose stack     at TLSSocket.emit (node:events:539:35)
43 verbose stack     at emitErrorNT (node:internal/streams/destroy:164:8)
43 verbose stack     at emitErrorCloseNT (node:internal/streams/destroy:129:3)
43 verbose stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
44 verbose cwd /home/tracert6/Downloads/test
45 verbose Linux 5.16.8-arch1-1
46 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "uuid"
47 verbose node v17.6.0
48 verbose npm  v8.5.3
49 error code ETIMEDOUT
50 error syscall connect
51 error errno ETIMEDOUT
52 error network request to https://registry.npmjs.org/uuid failed, reason: connect ETIMEDOUT 2606:4700::6810:1023:443
53 error network This is a problem related to network connectivity.
53 error network In most cases you are behind a proxy or have bad network settings.
53 error network
53 error network If you are behind a proxy, please make sure that the
53 error network 'proxy' config is set properly.  See: 'npm help config'
54 verbose exit 1
55 timing npm Completed in 459930ms
56 verbose unfinished npm timer reify 1646774907342
57 verbose unfinished npm timer reify:loadTrees 1646774907350
58 verbose code 1
59 error A complete log of this run can be found in:
59 error     /home/tracert6/.npm/_logs/2022-03-08T21_28_27_148Z-debug-0.log

I ran the command you suggested in Arch Linux, but got no response. I tried same command in Debian in the same network, and got a json result immediately.

@nlf
Copy link
Contributor

nlf commented Mar 8, 2022

this is an underlying problem in your arch linux installation it seems. if the above curl command works, then npm should also work, but right now due to the problems with your ipv6 network you're getting the timeout instead. unfortunately not much we can do to help with that one, it'll be on you to figure out how to get your ipv6 stack working correctly.

@fwsmit
Copy link
Author

fwsmit commented Mar 12, 2022

Not sure if relevent, but I gave the curl command some time to complete, but it didn't give any results. I don't have ipv6, though.

The issue I had seems to be resolved, though. npm install works again! I'll close this issue

@fwsmit fwsmit closed this as completed Mar 12, 2022
@sanzhardanybayev
Copy link

In my case the problem was in my server's DNS. Once I changed it to Google's installation went fine.

@Arturexe
Copy link

Arturexe commented May 15, 2022

I'm on node 18 with npm 8.6 and this is still happening to me out of nowhere. This morning I've set up a new project and now suddenly I can't use npm anymore.

@MatiasDuhalde
Copy link

I had this problem some time ago, and just as @nlf suggested here #4309 (comment), it was related to my IPv6 stack configuration, and the problem was not limited to the npm registry, but also extended to the communication with other services that use IPv6, as I could diagnose later. Also, in my personal case, the problem was not exactly my OS, but my local network router. After tinkering some time with the router configuration, I could make it work. Unfortunately I can't give more insight on how, since I can't recall the settings I modified, and I'm not very skilled in networking.

@marianoarga
Copy link

In my case being behind a VPN was causing this issue, I disconnected and it ran just fine

@mohammadalijafri
Copy link

Had this issue just now, also behind a VPN like Mariano. Fixed by simply restarting connection to Wifi

@sabinahschmitz
Copy link

It worked for me when I changed to another Wifi.

@treysis
Copy link

treysis commented Aug 10, 2022

I don't have ipv6, though.
It looks like you DO have IPv6. Otherwise, your OS shouldn't request IPv6 records for domains which it did in your case.

@gidgudgod
Copy link

I reconnect my wifi and it worked back

@SpecialYang
Copy link

Updating registry works for me.

@SilentFlute
Copy link

change the registry will help, we should set registry manually since it's stucked.
u have installed nrm already? wow, awesome ;)
when u set the registry yourself, dont forget set it both if u use yarn:
$ npm config set registry=xxx
and
$ yarn config set registry xxx
note that yarn use space to assign value, but npm use = to instead

@Sofact
Copy link

Sofact commented Nov 25, 2022

For me work disable the IPV6 in the ethernet

@treysis
Copy link

treysis commented Nov 26, 2022

For me work disable the IPV6 in the ethernet

You should fix your IPv6, not disable it.

@treyspeakman
Copy link

Signing into my VPN fixed this for me. No clue why

@krave1986
Copy link

Same things happen here. I built a VPN service myself. Unfortunately my server provider - kamatera does not support IPv6 right now. So I have to switch another provider to finish the installation of the package. Thanks @nlf for the hint.

@Barak-Men
Copy link

had the same issue on windows 11. npm vsrsions 18-19, restarting my pc solve the problem.

@claudenobs
Copy link

claudenobs commented Feb 4, 2023

In my case being behind a VPN was causing this issue, I disconnected and it ran just fine

In my case the problem persisted after vpn disconnection. Manually flushing the routing table fixed it.

@sharukhi
Copy link

sharukhi commented Apr 7, 2023

npm install -g registry.npmjs.org
npm config set registry https://registry.npmjs.org --global

Worked for me.

@ljharb
Copy link
Contributor

ljharb commented Apr 7, 2023

That first command should not be needed at all, and installs a package you won’t be using.

@SpencerKaiser
Copy link

SpencerKaiser commented Apr 18, 2023

My router changed my DNS settings without me knowing and that was the root cause...

If you make it this far in the thread and are still having issues, check your DNS settings!!!!!

@nlf you saved me with this comment 🙌 that tipped me off that the issue had nothing to do with npm

@jacobmakarsky
Copy link

jacobmakarsky commented Apr 24, 2023

Brand new M1 Mac Pro, fresh curl install of nvm and node confirmed. When running npm install in a project, just hangs on sill idealTree buildDeps infinitely.

Tried the MacOS trick: IPv6 Automatically -> Link-Local Only, did not work.

nvm -v 0.39.3
npm -v 9.6.4
node -v 20.0.0

Also noting that after the curl install curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash, opening a new terminal showed -bash: nvm: command not found.

I created a .bashrc in the user folder and added the required lines

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

This did nothing and each new terminal requires me to run source ~/.bashrc so nvm, node and npm load up.

I also disabled the macOS Ventura 13.3.1 Firewall.

Waited around a half hour for something to happen, and got a socket timeout error eventually. npm install -verbose seemed to get stuck on one package for awhile, started going through the rest slowly, but says (cache miss) at the end of each line

Still searching for a solution here

@cresencio
Copy link

on the same boat as @jacobmakarsky. Frustrsating

@KougamiJuan
Copy link

I have the same problem, I have no additional settings regarding my DNS in my IPv6. I also have no problems with running curl. I can't get any error log, it just stays in an infinite load. I also changed the registry but still the same behavior.

Just when I try to download the library it stays stuck indefinitely.

@SpencerKaiser
Copy link

@KougamiJuan another thing that's potentially worth trying is your auth... try npm login or npm logout as a means of getting your auth setup correctly

@jacobmakarsky
Copy link

Update:

I did npm install -verbose and realized it was getting stuck on a specific package every time, and a few of the times things would fail. I just attempted it until it worked. I had to let it hang for awhile, but it finally worked after several tries and installed. The issue is, if it hangs too long it times out.

Btw, I then got nvm to load in on each new terminal by creating a .bash_profile file instead of the other options, and that works now too.

@mixn
Copy link

mixn commented May 3, 2023

In my case being behind a VPN was causing this issue, I disconnected and it ran just fine

This worked for me, too. Thank you.

@KougamiJuan
Copy link

SpencerKaiser

I forgot to comment here but doing this worked. I'm really confused. Why did it work when I did this? Was it because of some setting I had and didn't know?

@SpencerKaiser
Copy link

@KougamiJuan dude I wish I could tell you... none of this makes sense to me. That worked briefly and then it broke again for me yesterday 🤷‍♂️

@treysis
Copy link

treysis commented May 3, 2023

Probably because the VPN instead of supporting IPv6 simply blocks IPv6 traffic? So npm still resolves AAAA records, although no connection to IPv6 destinations is possible. Which VPN provider is it if I may ask?

@reeveng
Copy link

reeveng commented May 18, 2023

I also had this issue, I managed to resolve my issues by installing protonvpn and using the vpn.

@SpencerKaiser
Copy link

@treysis my DNS provider is Spectrum, same with another dev who commented on a related post; I know you were asking about vpns but figured that context might help as well

@treysis
Copy link

treysis commented May 19, 2023

Actually, the DNS provider is irrelevant. The OS can request any DNS record type from DNS it wants.

@RalphOb
Copy link

RalphOb commented Jul 31, 2023

For me work disable the IPV6 in the ethernet

Work for me too on Windows

@treysis
Copy link

treysis commented Jul 31, 2023

For me work disable the IPV6 in the ethernet

Work for me too on Windows

You shouldn't disable IPv6 as it might cause other problems. Also Microsoft strongly discourages disabling it.

@SwapnilSoni1999
Copy link

Setting from system wasnt enough so had to set Ipv4 from router settings and it worked!

@Chaoste
Copy link

Chaoste commented Sep 11, 2023

Possible Solution for MacOS users

This is really a difficult problem I have been struggling with for months. Often, I switched to node v16, installed my packages, and switched back to v18. At some point, I realized that I only get this issue in my home WiFi - not in the office or via my smartphone's hotspot.

This issue as well as #4163 helped me realise that it must be related to IPv6. I visited https://test-ipv6.com and the analysis reported that IPv6 is not working at all for me. Things like ping6 google.com didn't work indeed. I opened the page on my smartphone which is in the same WiFi and got a green success report. Thus, I assumed that it must be related to my OS (MacBook Pro 2021, M1 Pro, Ventura 13.5).
Googling for MacOS IPv6 issues, I stumbled across this thread in the Apple forum. The solution worked for me like a charm! By switching the Location setting in my network settings to a new one, all problems disappeared. The test analysis is green and npm i works as well as npm ping. I don't know much about these network configurations but was very happy to find a "sustainable" solution.

Screenshot 2023-09-11 at 12 02 50

Other Ideas For You

If this doesn't work for you (or you're not on MacOS), you might wanna try the following solutions/ hacks:

  1. Disable IPv6 in general for your network (DISCOURAGED)
  2. Use IPv4 only when calling npm by adding this alias in your bash profile (source):
    alias npm="node --dns-result-order=ipv4first $(which npm)"
  3. For some people in Windows, this comment appears to be a solution.

@willisplummer
Copy link

I was able to resolve by upgrading to node 20.9.0 and npm 10.1.0

@leksam
Copy link

leksam commented Nov 14, 2023

In my case after troubleshooting for a day and half what I did was to completely uninstall the existing version of node and npm I had on my system then, I downloaded a newer version of node (Recommended for most users) which has npm package embedded. Restarted my system after installation and guess what? It worked!

@siaikin
Copy link

siaikin commented Dec 11, 2023

我能够通过升级到节点 20.9.0 和 npm 10.1.0 来解决

thanks! work for me.

@hitecSmartHome
Copy link

(windows) Nothing works for me.

  1. Installed latest node.js, latest npm.
  2. Restarted PC.
  3. Cleared npm cache
  4. npm i registry.npmjs.org
  5. npm config set registry http://registry.npmjs.org/ --global
  6. Deleted node_modules and package-lock.json
  7. Restarted router
  8. Disabled IPV6 in network config

If i set strict-ssl to false, npm works. OFC I don't want to use this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests