Node: npm install failure due to proxy config! What now? - node.js

I was trying to run node with the angular.js tutorial application and I found that npm isntall was not behaving itself.
I got a strange little spinning character that seemed to never stop.
I ran npm install -verbose and got the following debug trace:
216 error network tunneling socket could not be established, cause=connect ETIMEDOUT
216 error network This is most likely not a problem with npm itself
216 error network and is related to network connectivity.
216 error network In most cases you are behind a proxy or have bad network settings.
216 error network
216 error network If you are behind a proxy, please make sure that the
216 error network 'proxy' config is set properly. See: 'npm help config'
SO I've identified a problem. I've no idea how to go about fixing it. What do?

Must configure the proxy you are using, in npm.
npm config set proxy http://<proxy-url>:<port>
npm config set https-proxy http://<proxy-url>:<port>
If you don't know proxy url, could get it by registry, in cmd run:
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | find /i "proxyserver"
Hope it helps, I faced the same error.

I had a similar problem once and i solved it by :-
npm config set proxy
npm config set registry "http://registry.npmjs.org/"

I am also facing the same error of Proxy settings, first i found this was happening for default browsers settings problems.
npm config set rm proxy http.
npm config set rm https-proxy http.
Then Uninstall your Chrome browser and npm. Make default browser in Edge, then install npm and try the React-cli command.

Related

npm install shows 403 Error on Ubuntu on Windows 10 behind proxy

I'm using ubuntu on Windows 10 to install and run npm.
I downloaded nodejs using:
curl -sL https://deb.nodesource.com/setup_10.x | bash
apt-get install -yq nodejs
I set my proxy parameters using:
npm config set proxy http://my.domain.name:port
npm config set https-proxy http://my.domain.name:port
When doing npm install I get the following error:
...
npm ERR! code E403
npm ERR! 403 Forbidden - GET https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz
npm ERR! A complete log of this run can be found in:
...
I've checked similar posts but without any success:
Using npm behind corporate proxy .pac
npm behind a proxy fails with status 403
Please let me know if you have any idea on this one, best
try this
export https_proxy=http://my.domain.name:port
export http_proxy=http://my.domain.name:port
Finally managed to solve my problem. The proxy settings defined by our admin didn't allow connections to https://registry.npmjs.org/. I had to define an exception to that particular address in my windows 10 proxy settings.
Thanks for your help

getaddrinfo EAI_AGAIN registry.npmjs.org:80

Hi guys I'm trying to publish my angular library in npm, but when I login I get this:
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to http://registry.npmjs.org/-/user/org.couchdb.user:belzee10 failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:80
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\belzee\AppData\Roaming\npm-cache\_logs\2018-01-08T16_03_35_050Z-debug.log
versions
node: 8.9.3
npm: 5.5.1
I am behind an authenticated proxy and I have already configured: proxy and https-proxy
npm config set proxy http: // Username: Pa55w0rd # proxyhostname: port
npm config set https-proxy http: // Username: Pa55w0rd # proxyhostname: port
Thank you for your attention
npm config rm proxy
npm config rm https-proxy
Use the above commands and restart the system. It worked for me.
This drove me crazy for hours and I didn't even know what I did to make it work. But the last thing I tried was:
In cmd typed ping registry.npmjs.org.
Error couldn't find the host
Open hosts file through this: https://support.rackspace.com/how-to/modify-your-hosts-file/
Added 151.101.72.162 registry.npmjs.org to a new line.
Save.
Tried installing a package, still didn't work
But I randomly tried to ping registry.npmjs.org again, and it worked!
Tried installing a package again, still didn't work.
Removed the 151.101.72.162 registry.npmjs.org and saved again. Practically reverting the last edit.
Tried installing and it's working now. Why???? I have no idea. For all I know there's a minor deity inside my laptop and I randomly appeased it somehow...
I had this problem in a WSL1 Linux container on a Windows 10 host in a corporate network.
Adding a new nameserver to the top of /etc/resolv.conf as either 9.9.9.9 or 1.1.1.1 fixed the issue.
Try to connect to some other network.
This error resemble some issue with network. I was trying to install a lib from NPM on windows but getting this error. This worked for me. Maybe it might help you too.
The following github link resolved the issue for me ->
https://github.com/StefanScherer/dockerfiles-windows/issues/270#issuecomment-382229052
create the file /etc/docker/daemon.json
and insert:
{
"dns": ["10.0.0.2", "8.8.8.8"]
}
and then restarting pc
First run
npm i npm#latest
and check error is coming again or not. if it is
Try to resolve your proxy settings
For Linux(ubuntu)
https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-configure-proxy-on-ubuntu-18-04/
For windows
https://www.howtogeek.com/tips/how-to-set-your-proxy-settings-in-windows-8.1/
Changed the registry as https://registry.npmjs.org/ in .npmrc file.
In terminal:
npm config rm proxy
npm config rm https-proxy
Restarted the system.
npm i worked :-)
in my case, there must have been network instability, I deactivated then reactivated my internet connection, it works now!
That error means a domain name resolution error in Node.
I'm not sure what exactly could be your issue here, but https://www.codingdefined.com/2015/06/nodejs-error-errno-eaiagain.html has some good info.
This error is definitely due to the proxy you have set up. I had a similar issue earlier, and disabling the proxy worked for me.
I had the same problem you can check if you opening a session that connecting database, you can try disabling any sessions on the database and try again using npm i filepond

NPM error install angular 2 CLI : tunneling socket could not be established, statusCode=405

When i installed angular 2 cli I get an error with the NPM :
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node":
tunneling socket could not be established, statusCode=405
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
node -v : 6.9.4,
npm -v :3.10.10
I don't use proxy. I have done few things like :
npm config rm proxy
npm config rm https-proxy
npm config set proxy false
npm cache clean
npm config set registry "https://registry.npmjs.org/"
but not working, I also have searched stackoverflow for few days, I don't get a solution, thank you..
HI I was facing the same issue and i did following configuration change.
Execute following commands in command prompt.
npm config set proxy null
npm config set https-proxy null
Hope it help you as well.

Failed to install dependencies when npm install hexo-cli -g

when I run npm install hexo-cli -g in git bash terminal in my computer, I experience a network proxy issue as shown by image below:
code in the git bash
Seems like your computer is behind a proxy/firewall. If you configure the proxy correctly it might work. Try this:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Don´t forget to change proxy.company.com:8080 with values from your proxy (you can find it in your Internet Explorer network configuration). More information can be found here
If this don´t help, please, provide us the npm-debug.log file.

npm ERR! network getaddrinfo ENOTFOUND

I am getting npm ERR! network getaddrinfo ENOTFOUND error while trying to install any package using NPM. I know there are numerous threads on the same issue but I could not find any thread which can help me.
I have set the proxy & I think its something to do with proxy not being set correctly\not using the correct url.
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Is there any way to check the URL I am using while setting proxy is correct? Are there any steps I need to take in order rectify this issue?
Maybe it's because the proxy do not stand for https.
What I do is clear the proxy content of ~/.npmrc, or use
npm config delete proxy
What's more, nrm is recommended for this problem.
I was setting proxy as
npm config set http_proxy=http://domain:8080
instead of using the correct way
npm config set proxy http://domain:8080
Instead of setting the proxy usingnpm config set http_proxy=http://address:8080 go to ~/.npmrc and remove the proxy config. This resolved my issue.
I also faced this error but I was not working behind a proxy server at the moment so using npm config set proxy=http://address:8080 couldn't help and ~/.npmrc didn't contain any proxy setting either. The solution in my case was just to restart my computer.
I got the exact same error and this is what i did.
npm config get proxy
and it returned "null"
Opened "C:\Users\Myname.npmrc" in a notepad and made some changes. This is how my .npmrc file looks now
http-proxy=http://proxyhost/:proxyport
strict-ssl=false
registry=http://registry.npmjs.org/
The solution which worked for me:
Delete proxy: npm config delete proxy
Check npm config get proxy which should return null
Now, check if you are able to install the package. If not working, try manually editing the config, type: npm config edit, remember you are in VI editor.
Add ; before(for commenting out):
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Save and exit the file :x
Now, try installing the packages. It should work.
does your proxy require you to authenticate? because if it does, you might want you configure your proxy like this.
placeholder names.
username is a placeholder for your actual username.
password is a placeholder for your actual password.
proxy.company.com is a placeholder for your actualy proxy
*port" is your actualy port the proxy goes through. its usualy 8080
npm config set proxy "http://username:password#proxy.company.com:port"
npm config set https-proxy "http://username:password#proxy.company.com:port"
It happens due to proxy errors:
try this in cmd
npm config get proxy
if this is not null, then go to
c/users/computerName/.npmrc
open this in notepad
now clear the proxy line completely
try the above cmd
if it is null
then install angular
npm i -g #angular/cli
I had this issue in my Arch Linux distro with npm 14.3.0 (w/ npm 6.14.5). I simply deleted the ~/.npm directory and tried again and this time it worked.
For me removing the ~/Users/.npmrc from the folder helped.
I had incorrectly typed in the address as
http://addressOfProxy.8080
instead of
http://addressOfProxy:8080
(Notice the colon before the port number 8080.)
First I check whether proxy is set for me or not using this :
npm config get proxy
It returned null then I run this command
npm config set strict-ssl=false
It disable strict-ssl for that cmd session.
You can see complete list of config using this
npm config list ls -l
Step 1: Set the proxy
npm set proxy http://username:password#companyProxy:8080
npm set https-proxy http://username:password#companyProxy:8080
npm config set strict-ssl false -g
NOTES: No special characters in password except # allowed.
for some reason my error kept pointing to the "proxy" property in the config file. Which was misleading. During my troubleshooting I was trying different values for the proxy and https-proxy properties, but would only get the error stating to make sure the proxy config was set properly, and pointing to an older value.
Using, NPM CONFIG LS -L command lists all the properties and values in the config file. I was then able to see the value in question was matching the https-proxy, therefore using the https-proxy. So I changed the proxy (my company uses different ones) and then it worked. figured I would add this, as with these subtle confusing errors, every perspective on it helps.
Just unset the proxy host using :
unset HOST
This worked for me.
Make sure to use the latest npm version while installing packages using npm.
While installing JavaScript, mention the latest version of NodeJS. For example, while installing JavaScript using devtools, use the below code:
devtools i --javascript nodejs:10.15.1
This will download and install the mentioned NodeJS version. Try installing the packages with npm after updating the version. This worked for me.
Take a look at your HTTP_PROXY and HTTPS_PROXY environment variables.
I thought mine were set correctly, as http://username:password#proxyhost:proxyport, but it turned out that they were actually causing the problem! After deleting those variables, and restarting the commant prompt, the npm commands worked again.
Well, everybody giving their answer so I thought I write too.
I am having the same proxy issue as all others. To solve this I tried many solutions but it did not work.
Search .npmrc file name in C:\Users\your_username drive and than add this line:
http://proxy.company.com:8888
I did only this and my is solved.
Step 1: Check whether proxy is set for you or not
npm config get proxy
Step 2: If it returned null and you also don't want any proxy, go to ~/Users/.npmrc
Open the file and make sure it has the following written:
registry=http://registry.npmjs.org/
Disable strict-ssl for cmd session
npm config set strict-ssl=false
Try to npm install now
P.S Now if get proxy didn't return null check if the proxy is correct or else set it with
npm config set proxy http://proxy.example.com:6500
in my case, the error was I wasn't being consistent in usage of package manager, previously I installed my all packages with yarn and now I was using npm to install moment-timezone package and was facing this error, when I tried to install the package with yarn it was done successfully with command yarn add moment-timezone
Had the same issue but non of the above help then I tried this:
ipconfig /flushdns
ipconfig /renew
After that everything worked as expected.
I hope it helps you guys
The solution which worked for me:
Delete proxy: npm config delete proxy. Also npm config delete https-proxy
Check
npm config get proxy
npm config get https-proxy
This should return null
Now, check if you are able to install the package.
I use WSL with Ubuntu distro. Had the same issue and none of the above solutions worked.
Ran the following command, then everything started working,
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
For me, my wifi network settings had DNS set to 8.8.8.8 I just removed that and ran npm i again and it worked!
go to the directory C:\Users\username and delete the npmrc file
this solved my issue
I was having some proxy configuration in my {$HOME}/.npmrc file.
Clearing it helped.
If your proxy config is fine, sometimes the problem can be a deprecated package-lock.json file, therefore it redirects to a non-existing artifactory, npm registry.
Try to delete the package-lock.json and try npm i again.
strict-ssl=false
proxy = http://ip_address_of_proxy:8088
https-proxy = https://ip_address_of_proxy:8088
registry = http://registry.npmjs.org/
This solution worked for me:
npm set https-proxy http://username:Password#proxyhost/:proxyport
npm config set strict-ssl false -g
Try to install now (e.g. npm i tailwind -g)

Resources