npm install freezes and shows idealTree:chatting: sill idealTree buildDeps

Viewed 17571

npm freezes when I am installing anything. Even after deleting package-lock.json nothing changed. Here is a similar question. Can anyone tell how can I solve this problem??

enter image description here

10 Answers

It could be your having an issue with your certificates. Sometimes if you get this behavior there is an error in the certificate chain.

Try npm set strict-ssl false to see if this resolves your issue. Just remember if you do this you have disabled some of the security ssl gives you.

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

Updating my npm using npm install -g npm@latest solved the issue.

In my case it was a regresion in npm v7.x related to dependencies pointing to specific gitlab url:

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

Here is the bug report.

From what I observe, this freeze takes around 60 seconds (some network timeout perhaps) then installation finishes successfully.

Use it:

npm install passport --legacy-peer-deps

I tried all the solutions I found on the Internet: removing the proxy, setting the ssl cert to false, removing node_modules, removing the package-lock... nothing worked...

Then, I updated my WSL Ubuntu 20.04 to 22.04 and it worked!

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt install update-manager-core
sudo nano /etc/update-manager/release-upgrades

change the Prompt value to Prompt = lts

sudo do-release-upgrade -d
cat /etc/os-release

for more info see this link

I had the same issue. I figured out that my project was running in another terminal. So I closed that terminal and package was successfully installed, then I runned the project again.

For me it was because I was using VPN, after closing it started working.

See this comment

In my case, like @Damo said in their answer, it was a problem with TLS certificates (due to a corporate VPN). It was stuck at idealTree buildDeps for a long time, but eventually it finished with this error: SELF_SIGNED_CERT_IN_CHAIN.

I didn't want to run npm set strict-ssl false due to the security implications. The reason npm is getting an apparently invalid certificate is because I'm connected to the corporate VPN, which acts like a man-in-the-middle (but one that can be trusted, as opposed to most MITM situations, of course).

So the secure solution is to tell npm to trust my company's CA certificate.

This is done by npm config set cafile <path-to-cafile>.

Since I'm running an Ubuntu docker container, this is how I did it:

  1. Obtained the company's CA certificate in PEM format. 1
  2. Configured ubuntu to trust it following the steps of this answer
  3. Verified that curl https://registry.npmjs.org/ is working without certificate errors
  4. Tell npm to use the CA certificate: npm config set cafile /etc/ssl/certs/ca-certificates.crt (don't ask me why npm doesn't do this by default)

Done!


1 If you don't know who to ask for this, you can simply access any HTTPS website (such as stackoverflow) and see and download the root certificate (it won't be the standard stackoverflow certificate, because of your company's MITM VPN):

enter image description here

I just turned my WIFI off and back on again and it worked.

Related