StefanScherer / dockerfiles-windows

Various Dockerfiles for Windows Containers
MIT License
1.11k stars 396 forks source link

NPM, React and Docker : npm ERR! request to https://registry.npmjs.org/react failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org #427

Closed karanvij-ai closed 5 years ago

karanvij-ai commented 5 years ago

Hi All,

I am running Docker Toolbox on windows 10 home.

Following were the steps(In Docker console -> Docker Quick Start and using bash from git installation):

npm install -g create-react-app create-react-app frontend cd frontend npm run test npm run build 6.npm run start code . Created docker file(Dockerfile.dev): FROM node:alpine

WORKDIR '/app'

COPY package.json .

RUN npm install

COPY . .

CMD ["npm", "run", "start"] $ docker build -f Dockerfile.dev .

Output in console:

Sending build context to Docker daemon 146.5MB Step 1/6 : FROM node:alpine ---> ef7d474eab14 Step 2/6 : WORKDIR '/app' ---> Using cache ---> c47b0eb2c3c1 Step 3/6 : COPY package.json . ---> Using cache ---> e5c66b740c8b Step 4/6 : RUN npm install ---> Running in 962746bea142 npm ERR! code EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR! request to https://registry.npmjs.org/react failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-09-21T01_00_35_350Z-debug.log The command '/bin/sh -c npm install' returned a non-zero code: 1 Also, I couldn't find the complete log, not sure where is location.

Please help, Thanks

StefanScherer commented 5 years ago

Hi @karanvij-ai It looks like there are DNS problems in your environment, check local network settings and if you can reach the URL from another container. As you have Docker Toolbox you are building Linux containers. This GitHub repository is only for Windows Dockerfiles. You may find a solution in another place on GitHub.

karanvij-ai commented 5 years ago

Thanks Stefan.

But strange, I ran the build command second time, it installed the npm on container. So as of now it is working for me.