npm ERR! network getaddrinfo ENOTFOUND

2019-01-11 09:17发布

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?

enter image description here

标签: node.js npm
11条回答
太酷不给撩
2楼-- · 2019-01-11 09:53

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.

查看更多
3楼-- · 2019-01-11 09:53

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
查看更多
甜甜的少女心
4楼-- · 2019-01-11 09:55

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.

查看更多
爷、活的狠高调
5楼-- · 2019-01-11 10:03

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.

查看更多
我命由我不由天
6楼-- · 2019-01-11 10:07

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.

查看更多
登录 后发表回答