Search code examples
node.jsnpmyarnpkg

Yarn Socket connection timeout


When I try to install a package using Yarn I get following error:

yarn add @mantine/prism    
yarn add v1.22.19
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@mantine%2fprism: Socket connection timeout".
info If you think this is a bug, please open a bug report with the information provided in "/home/rayorole/code/etherspay/etherspay-coming-soon/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

I also tried using NPM, but this loads indefinetly with no error at all. I assume its the same error with NPM

I tried rebooting my system, updating using apt-get update, changing networks, ... nothing works the error persists. I have a stable internet connection

I did get following warning trying to update my system:

W: https://dl.yarnpkg.com/debian/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.


Solution

  • It seems I have found a solution. I added following lines to /etc/sysctl.conf

    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
    

    After that, I applied the changes using

    sudo sysctl -p