npm ERR! network getaddrinfo ENOTFOUND
node.jsNpmnode.js Problem Overview
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?
node.js Solutions
Solution 1 - node.js
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.
Solution 2 - node.js
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
Solution 3 - node.js
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.
Solution 4 - node.js
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.
Solution 5 - node.js
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/
Solution 6 - node.js
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:[email protected]:port"
npm config set https-proxy "http://username:[email protected]:port"
Solution 7 - node.js
The solution which worked for me:
- Delete proxy:
npm config delete proxy
- Check
npm config get proxy
which should returnnull
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.
Solution 8 - node.js
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
Solution 9 - node.js
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.
Solution 10 - node.js
For me removing the ~/Users/.npmrc from the folder helped.
Solution 11 - node.js
I had incorrectly typed in the address as
http://addressOfProxy.8080
instead of
http://addressOfProxy:8080
(Notice the colon before the port number 8080.)
Solution 12 - node.js
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
Solution 13 - node.js
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.
Solution 14 - node.js
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.
Solution 15 - node.js
Just unset the proxy host using :
unset HOST
This worked for me.
Solution 16 - node.js
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.
Solution 17 - node.js
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.
Solution 18 - node.js
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.
Solution 19 - node.js
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
Solution 20 - node.js
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
Solution 21 - node.js
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
Solution 22 - node.js
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.
Solution 23 - node.js
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
Solution 24 - node.js
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
)
Solution 25 - node.js
strict-ssl=false
> proxy = http://ip_address_of_proxy:8088
> https-proxy = https://ip_address_of_proxy:8088
> registry = http://registry.npmjs.org/