yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.37k stars 2.72k forks source link

yarn install timing out #8948

Closed fxmb closed 1 year ago

fxmb commented 1 year ago
PATH: 
  /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin

Yarn version: 
  1.19.0

Node version: 
  20.0.0

Platform: 
  darwin arm64

Trace: 
  Error [ERR_SOCKET_CONNECTION_TIMEOUT]: Socket connection timeout
      at new NodeError (node:internal/errors:399:5)
      at internalConnectMultiple (node:net:1098:20)
      at Timeout.internalConnectMultipleTimeout (node:net:1637:3)
      at listOnTimeout (node:internal/timers:575:11)
      at process.processTimers (node:internal/timers:514:7)

Whatever command I run from whatever network connection speed (its fast), I get this error:

An unexpected error occurred: "https://registry.yarnpkg.com/<package-xy>: Socket connection timeout".

Even increasing the timeout until forever does not work:

yarn add --dev @types/estree --network-timeout 1000000000

This fails like 1-2 seconds after I initate the command.

I tried to...

  1. yarn clean cache
  2. Switch the registry to npm (same erro)

My internet connection is more than fine though, what could be going on? Thanks

siddharthroy12 commented 1 year ago

I've got the same exact issue

image

seba-campo commented 1 year ago

Hi, I'm with the same issue:

issueYarn

I have a good internet connection

hussainahmad commented 1 year ago

I installed the latest yarn package, I am also getting this issue as describe above.

phoenix0706 commented 1 year ago

image I also had the same issue even though network connection was strong enough.

marx-xdev commented 1 year ago

Same issue

arcanis commented 1 year ago

Socket connection error are network connection error and aren't caused by Yarn, but by your own network (or the registry network, which is operated by npm).

danielpuglisi commented 1 year ago

+1

joulev commented 1 year ago

I had this same problem for my laptop, after restarting it it worked again.

siddharthroy12 commented 1 year ago

I think Yarn is using ipv6 while Chrome is using ipv4 that's why I was able to browse internet just fine but yarn was struggling to even connect. After restarting my phone (I use my phone's hotspot) ipv6 is now working fine. I noticed git was also working slow and ping was not even working when trying to use ipv6 while ivp4 was working fine.

If you are facing this issue again try disabling ipv6 that may force yarn to use ipv4 which should fix this issue.

1mike12 commented 1 year ago

something to note is that for me it wasn't working with npm install either. But I spammed yarn install a few times and each time it looked like it was making more progress until it finally completed.

user@i9-MBP example % yarn install
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error An unexpected error occurred: "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz: Socket connection timeout".
info If you think this is a bug, please open a bug report with the information provided in "/Users/user/ExampleSoftwareProjects/react-native-ble-manager/example/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
user@i9-MBP example % yarn install
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error An unexpected error occurred: "https://registry.npmjs.org/react/-/react-18.2.0.tgz: Socket connection timeout".
info If you think this is a bug, please open a bug report with the information provided in "/Users/user/ExampleSoftwareProjects/react-native-ble-manager/example/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
^C
user@i9-MBP example % yarn install
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error An unexpected error occurred: "https://registry.npmjs.org/@react-native-community/cli-platform-android/-/cli-platform-android-10.1.3.tgz: Socket connection timeout".
info If you think this is a bug, please open a bug report with the information provided in "/Users/user/ExampleSoftwareProjects/react-native-ble-manager/example/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
user@i9-MBP example % npm install

user@i9-MBP example % ping npm.com
PING npm.com (104.75.170.176): 56 data bytes
64 bytes from 104.75.170.176: icmp_seq=0 ttl=53 time=122.877 ms
64 bytes from 104.75.170.176: icmp_seq=1 ttl=53 time=147.259 ms
64 bytes from 104.75.170.176: icmp_seq=2 ttl=53 time=127.912 ms
64 bytes from 104.75.170.176: icmp_seq=3 ttl=53 time=131.708 ms
^C
--- npm.com ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 122.877/132.439/147.259/9.112 ms
user@i9-MBP example % yarn install
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error An unexpected error occurred: "https://registry.npmjs.org/@react-native-community/cli-platform-android/-/cli-platform-android-10.1.3.tgz: Socket connection timeout".
info If you think this is a bug, please open a bug report with the information provided in "/Users/user/ExampleSoftwareProjects/react-native-ble-manager/example/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
user@i9-MBP example % yarn install
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
✨  Done in 6.27s.
user@i9-MBP example % yarn install
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
success Already up-to-date.
ivastly commented 1 year ago

same issue, it went through for me when I changed alpine version of base node image to just node-20.2.0 version.

chqamarali commented 11 months ago

Just remove yarn.lock file and run yarn install

gunayakay commented 10 months ago

Just remove yarn.lock file and run yarn install

Äą tried but Äąt doesnt worked for me

ascheucher-shopify-partner commented 10 months ago

I think Yarn is using ipv6 while Chrome is using ipv4 that's why I was able to browse internet just fine but yarn was struggling to even connect. After restarting my phone (I use my phone's hotspot) ipv6 is now working fine. I noticed git was also working slow and ping was not even working when trying to use ipv6 while ivp4 was working fine.

If you are facing this issue again try disabling ipv6 that may force yarn to use ipv4 which should fix this issue.

After setting my Network Settings -> Ethernet Settings -> TCP/IP -> IPv6 to Link-Local Only in the System Settings, the socket timeouts stopped.

Looks like, there is an issue with my IPv6 settings, network, whatever. Something to deal with another day.