node.jsnpmarchlinux

npm freezed while installing packages


While I was installing some packages using npm it just freezed, I'm using npm 10.3.0 and node 21.6.0 in ArchLinux

In other project it took abut 10 minuts and logged:

Using version ^1.28 for laravel/breeze

   INFO  Installing and building Node dependencies.  

npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/@tailwindcss%2fforms failed, reason: 
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

but my network is about 150 Mbps (fast.com)

Photos: when I was using npm

This one is when I use laravel (starter kid) Error while using laravel

/home/abdullajonov/.npm/_logs/2024-01-19T16_28_58_849Z-debug-0.log gives tonns of logs and I can't put all of them here


Solution

  • There could be IPv6 enabled that prevent npm registry to resolve. So the solution would be to turn IPv6 off in adapter settings. And also try to disable firewall.

    To do it:

    1. Open terminal
    sudo nano /etc/sysctl.conf
    

    type it

    1. Add the following lines:
    # Disable IPv6
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
    

    and save!

    1. Apply changes
    sudo sysctl --system
    
    1. To disable the firewall:
    sudo systemctl stop iptables
    

    then try to install some package using npm.