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 a year ago
  • Reactions: 21
  • Comments: 51 (3 by maintainers)

Most upvoted comments

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

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

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

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

Disable the Ipv6 was the solution. Thanks

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

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

Disable IPv6 in Adapter Settings (Windows 11)

  • 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

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?

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

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.

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

Thanks!

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/