npm install takes forever, says I am behind a proxy - npm

I am trying to install different packages using npm 8.19.2. For example yarn
sudo npm install --global yarn
All I get is
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/yarn failed, reason: connect ETIMEDOUT 2606:4700::6810:1823: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/2022-12-08T20_14_13_653Z-debug-0.log
I have a fresh installation of Ubuntu 22.04. According to this: http://www.amibehindaproxy.com/ I am not behind a proxy. I do not understand why I should be either. In fact, I don't know what it is.
node --version
v18.12.1
My goal is to get started with react. First step is to just run npx create-react-app my-app. But that does not work.

wget was also slow, then I found this Slow wget speeds when connecting to https pages.
Updating the network settings and disabling IPv6 did the trick.

Related

getting error while npm install .how to solve this on ubuntu 18.04

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
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/samsi/.npm/_logs/2022-02-22T05_39_16_188Z-debug-0.log

Not able to change npm proxy settings

I was trying to install ExpressJs from npm was using the command:
npm i express
But I got the following error:
npm ERR! Linux 4.15.0-50-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "express"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code ECONNRESET
npm ERR! network tunneling socket could not be established, cause=connect ETIMEDOUT 10.7.0.1:8080
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'
npm ERR! Please include the following file with any support request:
npm ERR! /home/akhil/npm-debug.log
I suspect it is a proxy error. I use previously working under proxy (mentioned in the error 10.7.0.1:8080) but now I didn't want the proxy and was trying to remove it, for the I have tried the commands:
npm config rm proxy
npm config rm https-proxy
I have also tried adding -g to the above commands
Also I have used,
set HTTP_PROXY=null
set HTTPS_PROXY=null
When I use the command
npm config ls -l
It shows both proxy and https-proxy equal to null. But it seems the proxy has not actually changed looking at the error.
Any help on how to deal with this error would be appreciated.
First, set your proxy false
npm config set proxy false
After that clean your cache
npm cache clean
If that didn't help you and you are using proxy then try this:
npm config set proxy http://proxyhost:proxyport
npm config set https-proxy http://proxyhost:proxyport

Unable to install any modules (nodes) in Node-RED on hassio

I am unable to install any modules (nodes) in Node-RED on hassio running on a Raspberry Pi. It worked previously, but does not now. I have not changed any configuration although it is possible that node-red auto updated. When I attempt to install, I get this error:
npm info it worked if it ends with ok
npm info using npm#5.6.0
npm info using node#v10.0.0
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/node-red-contrib-telegrambot-home 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/2018-04-30T01_39_51_895Z-debug.log
There is no proxy. I tried to edit package.json to add the modules to dependencies but that also did not work.
It was a DNS problem. Pi-Hole was also running on the RPi and causing the issue. Set DNS to Google using this info.

How to install mfpdev-cli to offline environment?

I am trying to setup offline (does not have internet access) OS X machine for MobileFirst Platform 8.0 development, and failing to install MobileFirst CLI.
I am referring to this article.
I have installed 8.0.0.0-MFPF-DevKit-MacOSX-IF2016080923.zip on the offline machine, then run.sh and console.sh.
Development server has successfully launched, and now I can access to Operations Console.
I have downloaded mfpdev-cli.tar from the Console, and followed the article I cited above.
Copy mfpdev-cli.tar to online machine.
On the online machine, npm --cache ./.cache install mfpdev-cli.tar
Archive .cache directory, and copy the archive file to the offline machine.
On the offline machine, unarchive .cache directory.
sudo npm install --cache ./.cache ./mfpdev-cli.tar -g
Then, I got below:
npm ERR! fetch failed https://registry.npmjs.org/http-proxy/-/http-proxy-1.13.2.tgz
npm WARN retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
Those ERR! and WARN repeats for many other packages.
And at last:
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--cache" "./.cache" "./mfpdev-cli.tar" "-g"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
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'
npm ERR! Please include the following file with any support request:
npm ERR! /Users/babatch/Downloads/mfpdev-cli/npm-debug.log
How do I install mfpdev-cli on offline machine?
The problem is that npm is attempting to contact its online repository still due to some file dependency on the http-proxy package.
What you can do is to get/add this dependency independently and then try again.
I have tried some methods, and finally it got working.
The procedure is below:
On the online machine, npm install ./mfpdev-cli.tar (without -g)
cd node_modules
tar -cvzf mfpdev-cli.tgz mfpdev-cli and copy mfpdev-cli.tgz just created to the offline machine.
On the offline machine, tar -xvzf mfpdev-cli.tgz
sudo cp -r mfpdev-cli /usr/local/lib/node_modules
cd /usr/local/bin
sudo ln -s ../lib/node_modules/mfpdev-cli/bin/cli.js ./mfpdev
At present, it seems to be working fine.

Just CANNOT install ember-cli with npm

I'm running on mac osx yosemite 10.10.5 & this is what I get whenever I hit npm install -g ember-cli
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/itsfadnis/.nvm/versions/io.js/v3.3.1/bin/iojs" "/Users/itsfadnis/.nvm/versions/io.js/v3.3.1/bin/npm" "install" "-g" "ember-cli" "--no-optional"
npm ERR! node v3.3.1
npm ERR! npm v2.14.3
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT 103.245.222.162:80
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'
npm ERR! Please include the following file with any support request:
npm ERR! /Users/itsfadnis/npm-debug.log
I have tried the following and none have worked:
Reinstall node and npm
npm set registry http://registry.npmjs.org
Tried with different versions of node - v0.12.8, iojs-v3.3.1, v4.4.2, v5.0
Without optional dependencies npm install -g ember-cli
As administrator sudo npm install -g ember-cli
Network connection is absolutely fine and I'm not behind a proxy.
Any help on this would be appreciated. Thanks.
Turns out it was failing due to a firewall enabled on my router. Disabling it did the trick!