Linux terminal, npm install ETIMEDOUT - linux

I installed nodeJs and npm using nvm, that went perfectly, then I notice that a newer version of npm was available so i try
npm install -g npm#latest
But then it just stays as like that, it's like it does not start never, so I try another command and this happens
npm install -g n
Same thing, noting happens.
Trying and trying I manage to get the following error:
/home/jonathan/.nvm/versions/node/v18.12.1/bin/npx --yes --package #angular/cli ng new untitled --defaults
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/#angular%2fcli failed, reason: connect ETIMEDOUT 2606:4700::6810:1123:443
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'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jonathan/.npm/_logs/2022-12-28T05_07_38_682Z-debug-0.log
Done
So searching on the internet I found the url npm uses to attempt the installs the following:
registry.npmjs.org <
I tried then:
ping registry.npmjs.org
Same as above, it does nothing, it suppose to show some info every few seconds but nothing happens so y put the url in a browser and it works
{"db_name":"registry","engine":"couch_bt_engine","doc_count":3313520,"doc_del_count":332,"update_seq":31421891,"purge_seq":0,"compact_running":false,"sizes":{"active":69891815727,"external":214417993712,"file":70327402736},"disk_size":70327402736,"data_size":69891815727,"other":{"data_size":214417993712},"instance_start_time":"1672130582611333","disk_format_version":7,"committed_update_seq":31421891,"compacted_seq":31421548,"uuid":"3a4ad341a4111dd254daa731f37b37ae"}
That's what it shows.
So. I don't know what it's going on, I'm not using any proxy or firewall. Need some help here.
Update... I try using wifi not wired connection and it works, so the problem appears to be wired connection

Solution remains on network configuration, as Robert says its not related to programming so I'm marking this as answer. Thank any who try to help

Related

How can I install npm packages when I have a failed network request error?

I'm using a Mac with the zsh terminal, and I have node v16.13.1 on my machine.
I'm trying to install packages, but I haven't been successful. I get the error below, regardless of what package I try to install. I've also tried initializing first using npm -init, but I still get the same result.
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/figlet failed, reason: Client network socket disconnected before secure TLS connection was established
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'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/edgaracuna/.npm/_logs/2022-01-02T16_01_32_283Z-debug.log
How can I resolve this issue to be able to install node packages?
I was unable to recreate the issue, so I think this isn't a problem that you can directly solve. Either you have a firewall issue, or maybe the npm servers were down or broken at the time. Just try again later, reboot your computer or join a different wifi network.

Is there a way to solve ECONNRESET error when using npm? I need to restart the machine to fix it

After using the computer for a while I cant use npm install anymore. If I restart the computer then all gets back to working.
I am using macOS Mojave 10.14.3 with node v11.12.0 and npm 6.9.0.
Tried the solutions here: npm not working - "read ECONNRESET" but no success
npm i faker
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/faker failed, reason: read ECONNRESET
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'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/flaviomelo/.npm/_logs/2019-03-28T12_25_35_242Z-debug.log
It is always possible that for a few minutes, NPM was down - so try again now just in case.
But in general, I would start by trying to find where the problem lies.
Try this:
curl https://registry.npmjs.org/faker
That should produce pages and pages of JSON. If it doesn't, then it's possible that your terminal - for whatever reason - cannot access the internet. Comments below this answer have further steps you can try in debugging this.
If it does produce lots of JSON, then there is a problem in your version of NPM / node. As these seem to be the latest, try downgrading each to see if it's a new bug.
you can try these solutions
Solution 1:
MAC + LINUX
run this command with sudo
sudo npm install -g yo
Windows
run cmd as administrator and then run this command again
Solution 2:
run this command and then try
npm config set registry http://registry.npmjs.org/

NPM issue on Mac

I had been using VS Code for my development works, when all of a sudden my npm install commands stopped working and started giving me errors like below:
⸨░░░░░░░░░░░░░░░░░░⸩ ⠧ rollbackFailedOptional: verb npm-session abcd123456789efg
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/passport failed, reason: read ECONNRESET
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'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ajaywadhwani/.npm/_logs/2019-01-27T22_33_38_087Z-debug.log
I am not behind any proxy by any chance.
Interestingly, a ping to the link https://registry.npmjs.org/passport through my browser takes me to the webpage with the content, and can ping the website through terminal.
Kindly advise and suggest.
Try updating to the latest npm with the command npm install npm#latest -g.
I would also make sure there's no proxy set up by going to System Preferences > Network > your connection (Wi-Fi, for example) > Advanced... > Proxies and looking for any checked boxes.
Please let me know if these solutions work or not.

How to install node packages in ubuntu server with IPv6 only

I'm trying to install typescript on an Ubuntu server where only IPv6 address space is available.
I'm getting error as follows. Any help?
:/home/dev/.nvm# npm install --global typescript
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/typescript failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
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'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-11-01T19_15_39_294Z-debug.log
The error of this network connectivity happens with many packages and even github. I installed nvm in a slightly different way by setting the codebase in bitbucket.
I tried to install npm and n to setup typescript using n. That failed and I started using nvm as alternative. PFB the logs when trying to install n.
:~# sudo npm install -g n
npm ERR! Linux 4.4.0-98-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "n"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ENETUNREACH
npm ERR! errno ENETUNREACH
npm ERR! syscall connect
npm ERR! connect ENETUNREACH ::ffff:151.101.208.162:80 - Local (:::0)
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log
I just need some way to get it installed but no luck! I strongly believe it is IPv6 issue and looking for work around.
Btw, my ubuuntu server is 16.04.3 LTS. I have installed it successfully on IPv4 servers running on Ubuntu 16.10 and 17.04 version and here in Production, I'm locked!
I got that working after a change in registry. Could be a network problem that I faced on server OR the IPv6 only issue. Anyway the change in registry worked perfect.
sudo npm --registry http://registry.node-modules.io/ install n -g
After all the link below guided me to the answer.
Node-modules.io
Hope this will help somebody for the future reference!
Thanks for #Kalana Demel for the help to reach me to the answer.
Another workaround which will also work for yarn, is to add the resolved ip6s to /etc/hosts :
2606:4700::6810:1723 registry.yarnpkg.com
2606:4700::6810:1723 registry.npmjs.org
2606:4700::6810:ab63 yarnpkg.com
You can get the ip6s with nslookup registry.yarnpkg.com, nslookup ….
It seems the issue might be with proxy setting try using http instead of https, ipv6 issues seems to be resolved in the newer versions of npm as well.
npm config set registry http://registry.npmjs.org/
npm cache clean
Update
It seems that the issue which was supposed to be fixed in 8.5.0 is still there, so for IPV6 only networks npm is still not working even though Node is now passing the necessary flags, so till it's fixed you will have to find a workaround.
For more info : Node, NPM

Can't install node package even though I'm not using a proxy

I'm (very) new to nodejs and raspberry pi.
I'm trying to install the onoff package for a test project, following this tutorial.
Everything works fine and I've set up a new node project using npm init.
Installing onoff (npm install onoff) however fails.
It says:
npm ERR! network getaddrinfo ENOTFOUND npm ERR! network This is most
likely not a problem with npm itself npm ERR! network and is 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'
I've checked using npm config get proxy, this returns null so I don't think this is a proxy issue.
Anyone who can help me with this?
UPDATE:
ping 74.125.224.72returns "network is unreachable"

Resources