npm ERR! request to http://registry.npmjs.org/npm failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

npm ERR! request to http://registry.npmjs.org/npm failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

Using WSL when running npm install npm@latest -g I kept receiving an error:

npm ERR! request to http://registry.npmjs.org/npm failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

Steps to fix

sudo nano /etc/resolv.conf

Change the nameserver to:

nameserver 8.8.8.8

Resolve

Restart WSL

Categories: Category 1