在 build 容器镜像执行 npm ci 命令的过程中出现 socket 超时错误,请问如何解决?
#27 59.69 npm notice
#27 59.69 npm verb stack Error: Socket timeout
#27 59.69 npm verb stack at TLSSocket.onTimeout (/usr/local/lib/node_modules/npm/node_modules/agentkeepalive/lib/agent.js:346:23)
#27 59.69 npm verb stack at TLSSocket.emit (node:events:525:35)
#27 59.69 npm verb stack at TLSSocket.Socket._onTimeout (node:net:526:8)
#27 59.69 npm verb stack at listOnTimeout (node:internal/timers:559:17)
#27 59.69 npm verb stack at processTimers (node:internal/timers:502:7)
是 npm 缓存引起的,通过 docker system prune
清除缓存后正常了
如果不是通过 docker build 缓存的,可以用 npm cache clear --force
命令清除缓存