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?

enter image description here


Solution 1:

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:

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:

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.