pnpm: pnpm install fails when npm install succeeds

pnpm version:

➜ pnpm --version
8.3.0
➜ npm --version
9.5.0
➜ node --version
v18.15.0

Code to reproduce the issue:

This is a fresh install. I was using nodejs and npm and everything was working fine. A coworker suggested that we should use pnpm so I downloaded and tried to use it. From everything I read, it seemed like it would be a drop in replacement but theres something odd going on here. I tried installing from the standalone posix binary as well as using homebrew and both yield the same issue. npm install works fine, but pnpm install does not. No VPN. No proxy. Nothing that should get in the way. Can also curl the registry just fine. When I try running pnpm install this is the error that I get:

 WARN  GET https://registry.npmjs.org/@babel%2Fcore error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@babel%2Fpreset-env error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@babel%2Fpreset-typescript error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@cloudflare%2Fworkers-types error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/babel-jest error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@types%2Fjest error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/jest error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/jest-environment-miniflare error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/miniflare error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/ts-node error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/wrangler error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.

Saw another issue similar to this, but theres were closed due to a different issue. Googling for help is useless (really wish this project had a different name).

Expected behavior:

pnpm install would work out of box just like npm install

Actual behavior:

It doesn’t

Additional information:

NPM and Node versions above. On OSX M2 chip.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 48
  • Comments: 89 (5 by maintainers)

Most upvoted comments

Disable Ipv6 works fine Screenshot from 2023-04-29 15-29-56

confirmed this happens in ubuntu too, disabling ipv6 reduces install time from 10m to < 3s:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

On linux, simply change the DNS:

nano /etc/hosts/

And then add this line

104.16.26.34 registry.npmjs.org

facing the same issue on mac, tried reinstalling pnpm using brew and link it, its started working for me.

brew install pnpm
brew link pnpm

Disable Ipv6 works fine Screenshot from 2023-04-29 15-29-56

Disable the Ipv6 was the solution. Thanks

Disabled IPv6 on my LAN network connection and the error went away immediately, same as for @alinpr18 .

When I try to resolve the IPv6 address of registry.npmjs.org like this:

image

it seems pnpm is really trying to use the resolved IPv6 address here. It does not fall back to a IPv4 address.

If i try to browse the resolved IPV6 address directly, like:

https://[2606:4700::6810:1b23]/eslint-plugin-prettier

my browser does not get a response.

It seems the problem is the npm registry itself and the DNS entry for IPv6. npm and yarn seem to do a slightly different kind of name resolution ultimately resolving to a IPv4 address so they succeed.

That is likely the reason why it works for @alinpr18 to disable IPV6

I have this problem either on my Windows 11 computer.

And following actions will be a bit useful:

  • Disable IPV6/network LAN
  • Try setup a proxy
  • Change the registry

The problem now seems to appear only on pnpm 8.3.x

I had the same problem using ubuntu 22.04. To me works the following settings

  1. sudo nano /etc/sysctl.conf ADD >>> net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
  2. Apply the changes sudo sysctl -p
  3. sudo nano /etc/systemd/resolved.conf ADD >>> DNS=8.8.8.8 8.8.4.4
  4. Exec sudo systemctl restart systemd-resolved
  5. Reset npm Configuration npm config delete proxy npm config delete https-proxy npm config delete registry
  6. exec npx npm@latest install -g --verbose

Ran into the same problem trying to install vitest with pnpm, and disabling IPv6 indeed helped.

However I really hope this workaround wouldn’t remain a permanent requirment. I see it as a significant reason to hold back from using pnpm in projects, despite it’s advantages.

For covenience of future visitors of this thread, here’s a link to a random guide from a Google search about how to disable IPv6 on Windows: https://bigbluebutton.org/how-to-disable-ipv6/

npm install -g pnpm

This hint solved the issue for me. I had installed pnpm using wget and was getting

% pnpm install
Lockfile is up to date, resolution step is skipped
Packages: +1572
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1572, reused 1443, downloaded 0, added 0, done
node_modules/.pnpm/sharp@0.33.1/node_modules/sharp: Running install script...
node_modules/.pnpm/better-sqlite3@8.7.0/node_modules/better-sqlite3: Running install script...
 ELIFECYCLE  Command failed.

I deleted the following directory.

rm -rf ~/Library/pnpm

and installed it using npm as follows

npm install -g pnpm

and everything worked fine.

Disable IPv6 in Adapter Settings (Windows 11)

pnpm config set registry https://registry.npmjs.org/

pnpm install  

I had pnpm 8.15.4 installed on my machine. The repo I was working on had the following specified in package.json

“packageManager”: “pnpm@7.5.0”

After made the following changes and ran pnpm install this issue got fixed.

image

Had this GET https://registry.npmjs.org/create-vite error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left. issue when trying to install Vite with the command pnpm create vite.

I use pnpm version 8.14.1.

I was using WARP VPN by Cloudflare, and after turning off the VPN, the installation went through!

I got this issue a couple days ago and both of these worked for me (MacOS 13 Ventura):

Thanks!

So here’s an interesting bit. When I installed the command through npm, it worked fine.

I wonder if others can also reproduce this workaround? For @mjpitz the issue was present when installing from curl | sh or brew. But not when using npm install -g pnpm, without changing anything IPv6/networking related.

Could it be it’s both IPv6 related, and specific to the @pnpm/exe style standalone installation?

  • By disabling IPv6, your system may fall back to using IPv4 exclusively. This can sometimes result in more stable connections, particularly if there are compatibility issues or routing problems with IPv6.
  • Some firewall or security software may not handle IPv6 traffic properly, leading to blocked connections or timeouts. Disabling IPv6 bypasses this potential issue.

Overall, while IPv6 offers benefits such as a larger address space and improved routing efficiency, in some cases, disabling it can resolve connectivity issues, especially if there are configuration or compatibility issues with your network environment. However, it’s worth noting that IPv6 is the future of internet protocol, and disabling it should be considered a temporary workaround rather than a permanent solution. If possible, it’s recommended to investigate and address the underlying issues to ensure full IPv6 compatibility and future-proof your network infrastructure.

In my case I Disable and Enable IPv6 and its work perfectly

After reducing the node version from 20.19.2 to 18.20.8, It works.

How do i disable it in vercel ?? because my vercel build gives the same error whereas it works perfectly fine on my local machine

I turn off Cloudflare WARP and pnpm work for me!

I had this issue when using a proxy on my pc. fixed by adding https://pnpm.io/npmrc#proxy like proxy=http(s)://192.X.X.X:PORT to .npmrc

This still happens.

npm@10.7.0
pnpm@8.6.12
node@v20.15.0

I followed the the guide here to set IPv6 to Link-Local Only and that worked for me.

❯ pnpm --version
9.1.2

❯ node --version
v20.12.2

@neelabalan thanks, using IPv6 works

confirmed this happens in ubuntu too, disabling ipv6 reduces install time from 10m to < 3s:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

Works like a charm!

I have the same issue, I solved it by doing the following:

  1. delete proxy
$ unset http_proxy
$ unset https_proxy
  1. That still doesn’t work, and then I find a proxy configuration in .npmrc , delete and it works for me.
$ npm config delete http-proxy
$ npm config delete https-proxy
$ npm config delete proxy

image

On linux, simply change the DNS:

nano /etc/hosts/

And then add this line

104.16.26.34 registry.npmjs.org

Thanks a lot. This worked for me on Ubuntu 23.10.

i had this issue on windows 11 suddenly when i was trying pnpm outdated. it didn’t give errors yesterday & i probably updated windows 11 few days ago, not yesterday so idk how it appeared randomly.

oh, i think cloudflare warp gave that error because i updated it in the morning.

i followed this guide: https://www.windowscentral.com/software-apps/windows-11/how-to-disable-tcpipv6-ipv6-on-windows-11

but last 2 steps, i had to expand Local Area Connection and others & click on Edit besides More adapter options but that didn’t solve the error.

disabling cloudflare warp solved it.

Same issue with pnpm 8.14.1/node 18 on a Starlink/TPLink Deco XE75 (Wifi 6E) network on a Mac. Disabling IPV6 (setting the network to “Link-local only”) solved it temporarily.

+1 for disabling ipv6, thanks.

Still have this issue even after disabling IPV6 on Macbook Pro M1.

Maybe, in addition, you could configure your DNS, it worked for me 😃 image

I have the same problem (under Windows 11).

image

When I click on one of the links in the console, the browser opens immediately with the json from the package registry, so its not a network issue.

For reference I couldn’t reproduce on Linux.

Both node v18.15.0 + pnpm v8.3.0 and the latest node v18.16.0 + pnpm v8.3.1 work normally for me. Even when removing ./node_modules, ~/.cache/pnpm or ~/.local/share/pnpm/store/v3/files/.