pnpm icon indicating copy to clipboard operation
pnpm copied to clipboard

pnpm install fails when npm install succeeds

Open mjpitz opened this issue 1 year ago • 65 comments

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.

mjpitz avatar Apr 19 '23 12:04 mjpitz

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

beanow-at-crabnebula avatar Apr 19 '23 13:04 beanow-at-crabnebula

This is still happening with 8.3.1

mjpitz avatar Apr 19 '23 14:04 mjpitz

If there are no additional network configurations then I don't know why it would fail. Does it also fail on your colleague's machine? Does Yarn work?

zkochan avatar Apr 24 '23 01:04 zkochan

I don't have yarn installed nor was it declared as a required co-dependency.

mjpitz avatar Apr 24 '23 13:04 mjpitz

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

mjpitz avatar Apr 25 '23 19:04 mjpitz

I'm having the same problem, when I use yarn or npm they work normally

node 18.16.0 and pnpm 8.3.1

Giovani-f avatar Apr 28 '23 01:04 Giovani-f

I'm having the same problem. image

Video demostrative Screencast from 2023-04-29 15-21-52.webm

alinpr18 avatar Apr 29 '23 19:04 alinpr18

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

alinpr18 avatar Apr 29 '23 19:04 alinpr18

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.

gunters63 avatar May 02 '23 11:05 gunters63

Interesistengly, above command would log:

 WARN  GET https://registry.npmjs.org/@typescript-eslint%2Feslint-plugin error (ETIMEDOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/eslint error (ETIMEDOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/eslint-plugin-prettier error (ETIMEDOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/electron-updater error (ETIMEDOUT). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/eslint-plugin-react error (ETIMEDOUT). Will retry in 10 seconds. 2 retries left.

   and so on ....

then

 ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/eslint-plugin-prettier: request to https://registry.npmjs.org/eslint-plugin-prettier failed, reason: connect ETIMEDOUT 2606:4700::6810:1823:443
 ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/eslint-plugin-import: request to https://registry.npmjs.org/eslint-plugin-import failed, reason: connect ETIMEDOUT 2606:4700::6810:1823:443
 ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/husky: request to https://registry.npmjs.org/husky failed, reason: connect ETIMEDOUT 2606:4700::6810:1823:443
 ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/eslint-plugin-react: request to https://registry.npmjs.org/eslint-plugin-react failed, reason: connect ETIMEDOUT 2606:4700::6810:1823:443

In the end pnpm up will provide a list of package updates:

image

gunters63 avatar May 02 '23 12:05 gunters63

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

gunters63 avatar May 02 '23 12:05 gunters63

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

gunters63 avatar May 02 '23 12:05 gunters63

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

it might even work, but I don't think it's a valid resolution

Giovani-f avatar May 02 '23 14:05 Giovani-f

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?

beanow-at-crabnebula avatar May 03 '23 15:05 beanow-at-crabnebula

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

TalexDreamSoul avatar May 13 '23 14:05 TalexDreamSoul

Thank you @TalexDreamSoul. I resolved mine. I had installed pnpm with npm and it remained stuck at 8.3.0.  This was in my /User library. I removed it and the one installed through brew started working. I updated that version to 8.5.1.

Afrowave avatar May 27 '23 11:05 Afrowave

Also having this problem, forcing me to use a VPN to be able to download anything using pnpm. Sadly, my internet provider only hands out ipv6 addresses..

Using yarn or npm works because they seem to use a different way to resolve packages.

Mac M2 chip + pnpm v8.6

art-boer avatar Jun 02 '23 09:06 art-boer

I might have a slightly related issue:

  • I get the same warnings / timeouts when updating Node packages via topgrade (which uses pnpm)
  • pnpm on the command line works fine

When I disable IPv6 (on my Mac) the timeouts (in topgrade) are gone...

pro-sumer avatar Jun 14 '23 08:06 pro-sumer

In version 8.6.3 | windows; happened too, and once I disabled IPv6 in my network settings it started to work normally, I was able to use any command that involved a request

Sparking2 avatar Jun 20 '23 01:06 Sparking2

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

mikob avatar Jun 21 '23 01:06 mikob

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

Disable the Ipv6 was the solution. Thanks

matheusbozetti avatar Jul 07 '23 13:07 matheusbozetti

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

I was trying with other package managers, and in fact, I disabled IPv6, and it was fixed for npm, yarn, and pnpm. <3

wolfcito avatar Aug 10 '23 03:08 wolfcito

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/

NoamAnisfeld avatar Aug 13 '23 14:08 NoamAnisfeld

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

JasperGabriel avatar Aug 15 '23 04:08 JasperGabriel

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

wolfcito avatar Aug 15 '23 04:08 wolfcito

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

Thanks! It helped, but what ultimately worked was also connecting through a VPN. I think my local ISP has some issues with NPM for some reason.

JasperGabriel avatar Aug 15 '23 11:08 JasperGabriel

it worked for me thanks

sogeking7 avatar Aug 17 '23 20:08 sogeking7

+1 for disabling ipv6, thanks.

sshipsey avatar Sep 02 '23 05:09 sshipsey

I had the same problem. I just disabled IPV6 and also added the Cloudflare DNS servers (just in case). Now everything works fine.

MrOlivo avatar Sep 18 '23 02:09 MrOlivo

I am facing this problem but neither disabling IPV6 nor adding DNS servers do not work.

hieunguyen2211 avatar Sep 29 '23 02:09 hieunguyen2211