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 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/
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 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.
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.
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.