'npm ERR! code EAI_AGAIN error when trying to install express
I'm learning web development by going through a course and it was time to install express using node package manager. I had to install express and used the following command:
npm install express
and I got an error that said:
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/express failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-07-21T08_32_35_6
54Z-debug.log
I'm totally lost at the moment. Please don't judge me as I'm still extremely new to Node. Help would be really appreciated.
Solution 1:[1]
I had a similar issue and I just solved it with command sets that I found on the internet. I am sharing it to save your time.
npm config rm proxy
npm config rm https-proxy --tried removing npm proxy
I am sorry I can't add more detail to it, but this solved my issue of:
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/express failed, reason: getaddrinfo
EAI_AGAIN registry.npmjs.org
Solution 2:[2]
According to MicroSoft Docs EAI_AGAIN error code translate to temporary failure in name resolution, that is a DNS issue. So check network configuration and if possible switch to a different network.
Solution 3:[3]
This error is caused due to network issues, so in windows operating system run Troubleshooter, you may find errors like "Your DNS Server Might Be Unavailable". If you get this error, please reset your Network adapter.
Solution 4:[4]
You can also use the following command, it worked for me:
npm install --legacy-peer-deps
Solution 5:[5]
Can also confirm this was a network DNS issue. On Windows you can attempt to run
ipconfig /renew
but failing that, a restart of the machine or router should resolve the issue, otherwise contact your network admin.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | pravin poudel |
| Solution 2 | Ibnjunaid |
| Solution 3 | 1DA18ME430- Raghu BM |
| Solution 4 | Kumbu Kumbu Ezechias |
| Solution 5 | SuperStormer |
