npm install is failing in skaffold while building docker image

  docker, kubernetes, node.js, skaffold

I am new to docker and kubernetes, and i am trying to develope microservice app with nodeJs. I have different backend services using Express.
I am using skaffold for developement. It was working fine untill i added ui service to skaffold which uses react. Whenever i try to execute skaffold dev it exits the process with error

exiting dev mode because first build failed: unable to stream build output: The command '/bin/sh -c npm install' returned a non-zero code: 1. Please fix the Dockerfile and try again..

npm install always fails with different errors like

npm ERR! code EAI_AGAIN
npm ERR! syscall getaddrinfo
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/@material-ui%2ftypes 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/2021-03-03T10_06_04_586Z-debug.log

,

npm ERR! code EAI_AGAIN
npm ERR! syscall getaddrinfo
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/hoist-non-react-statics 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/2021-03-03T08_37_33_193Z-debug.log

,

npm ERR! code EAI_AGAIN
npm ERR! syscall getaddrinfo
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/@types%2freact-transition-group 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/2021-03-03T08_29_05_560Z-debug.log

,

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz failed, reason: Socket timeout

Is it the problem of networking inside kubernetes cluster because npm install works fine locally. even docker build works fine when i do it manually.

Thanks in advance !

Source: Docker Questions

LEAVE A COMMENT