I got this error i.e Warning EAI_AGAIN: request to https://registry.npmjs.org/@babel%2fcli failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

Viewed 730

Initially I got the same error while I wanted to install the css-loader using npm i --save-dev css-loader, then i followed these links npm WARN registry Unexpected warning for https://registry.npmjs.org/:
to sort out problem // when i run the npm i command for installing the below package

// It is the package.json file
        {
      "name": "HelloReact",
      "version": "1.0.0",
      "scripts": {
        "build": "webpack",
        "dev": "webpack-dev-server"
      },
      // List of dependencies which is required for my app

List item

      "dependencies": {                      
        "@babel/cli": "^7.11.6",
        "@babel/core": "^7.11.6",
        "@babel/polyfill": "^7.11.5",
        "@babel/preset-env": "^7.11.5",
        "@babel/preset-react": "^7.10.4",
        "babel-cli": "^6.26.0",
        "babel-loader": "^8.1.0",
        "babel-preset-env": "^1.7.0",
        "babel-preset-react": "^6.24.1",
        "webpack": "^4.44.2",
        "webpack-cli": "^3.3.12",
        "webpack-dev-server": "^3.11.0"
      }
    }

then i got the error i.e

Warning EAI_AGAIN: request to https://registry.npmjs.org/@babel%2fcli failed, reason: getaddrinfo 
EAI_AGAIN registry.npmjs.org
2 Answers

I got this error because of network

As @Hemant pointed out, this error could be because of your internet. Run echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null to temporarily change your DNS to one of the public ones provided by Google.

Related