npm install 在构建 docker 镜像时在 skaffold 中失败

时间:2021-03-03 10:55:24

标签: node.js docker kubernetes skaffold

我是 docker 和 kubernetes 的新手,我正在尝试使用 nodeJs 开发微服务应用程序。我使用 Express 有不同的后端服务。 我正在使用 skaffold 进行开发。它工作正常,直到我将 ui 服务添加到使用 react 的 skaffold。每当我尝试执行 skaffold dev 时,它都会以错误方式退出进程

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 总是失败并出现不同的错误,例如

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

是否是 kubernetes 集群内部网络的问题,因为 npm install 在本地工作正常。当我手动执行时,即使 docker build 也能正常工作。

提前致谢!

0 个答案:

没有答案