npm ERR! network getaddrinfo ENOTFOUND

前端 未结 17 885
傲寒
傲寒 2020-12-02 18:12

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

相关标签:
17条回答
  • 2020-12-02 18:35

    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/
    
    0 讨论(0)
  • 2020-12-02 18:36

    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.

    0 讨论(0)
  • 2020-12-02 18:37

    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.

    0 讨论(0)
  • 2020-12-02 18:39

    Just unset the proxy host using :

    unset HOST

    This worked for me.

    0 讨论(0)
  • 2020-12-02 18:40

    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.

    0 讨论(0)
  • 2020-12-02 18:43

    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.

    0 讨论(0)
提交回复
热议问题