npm ERR! network getaddrinfo ENOTFOUND

前端 未结 17 886
傲寒
傲寒 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:45

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

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

    The solution which worked for me:

    1. Delete proxy: npm config delete proxy
    2. Check npm config get proxy which should return null

    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.

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

    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.

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

    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.

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

    I had incorrectly typed in the address as

    http://addressOfProxy.8080
    

    instead of

    http://addressOfProxy:8080  
    

    (Notice the colon before the port number 8080.)

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