docker-node
docker-node copied to clipboard
Unexpected behavior of npm install in Docker build
Environment
- Platform: Windows WSL2 Ubuntu 20.04.5 LTS
- Docker Version: 20.10.22
- Node.js Version: 18.12.1
- Image Tag: All
Current Behavior
I'm trying to build an image to run my NestJS application but on npm install or npm ci step, It takes a very long time (like 10 to 20 minutes) before stopping to try and run into an FETCH_ERROR or ERR_SOCKET_TIMEOUT
Here is an example :
...
npm timing reify:retireShallow Completed in 1ms
npm timing reify:createSparse Completed in 151ms
npm timing reify:trashOmits Completed in 12ms
npm timing reify:loadBundles Completed in 0ms
npm verb audit error FetchError: request to https://registry.npmjs.org/-/npm/v1/security/audits/quick failed, reason: Socket timeout
npm verb audit error at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
npm verb audit error at ClientRequest.emit (node:events:513:28)
npm verb audit error at TLSSocket.socketErrorListener (node:_http_client:494:9)
npm verb audit error at TLSSocket.emit (node:events:525:35)
npm verb audit error at emitErrorNT (node:internal/streams/destroy:151:8)
npm verb audit error at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm verb audit error at processTicksAndRejections (node:internal/process/task_queues:82:21)
npm verb audit error at runNextTicks (node:internal/process/task_queues:64:3)
npm verb audit error at listOnTimeout (node:internal/timers:533:9)
npm verb audit error at process.processTimers (node:internal/timers:507:7)
npm verb audit error FetchError: request to https://registry.npmjs.org/-/npm/v1/security/audits/quick failed, reason: Socket timeout
npm verb audit error at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
npm verb audit error at ClientRequest.emit (node:events:513:28)
npm verb audit error at TLSSocket.socketErrorListener (node:_http_client:494:9)
npm verb audit error at TLSSocket.emit (node:events:525:35)
npm verb audit error at emitErrorNT (node:internal/streams/destroy:151:8)
npm verb audit error at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm verb audit error at processTicksAndRejections (node:internal/process/task_queues:82:21)
npm verb audit error at runNextTicks (node:internal/process/task_queues:64:3)
npm verb audit error at listOnTimeout (node:internal/timers:533:9)
npm verb audit error at process.processTimers (node:internal/timers:507:7) {
npm verb audit error code: 'ERR_SOCKET_TIMEOUT',
npm verb audit error timeout: 15000,
npm verb audit error errno: 'ERR_SOCKET_TIMEOUT',
npm verb audit error type: 'system'
npm verb audit error }
npm timing auditReport:getReport Completed in 80137ms
npm timing reify:audit Completed in 80137ms
Any help in diagnosing this issue would be appreciated. Thanks for your time
Additional Information
I'm running dockerd inside WSL2 Ubuntu and never had problems like that with docker or npm
This is a stale issue concerning a network error:
FetchError: request to https://registry.npmjs.org/-/npm/v1/security/audits/quick failed, reason: Socket timeout
using a version of Node.js 18.12.1 that reached end-of-life on 2025-04-30.