skip to Main Content

I’m encountering an error while trying to install the npm package "esbuild" in a Docker build process. The build was working fine previously, and I haven’t made any significant changes recently. However, the build now fails with the following error message:

 => ERROR [stage-0 5/6] RUN npm install                                                                                                                                                                                                                                          6.6s
------
 > [stage-0 5/6] RUN npm install:
#0 6.440 npm notice 
#0 6.440 npm notice New minor version of npm available! 9.6.7 -> 9.7.1
#0 6.440 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.7.1>
#0 6.440 npm notice Run `npm install -g [email protected]` to update!
#0 6.440 npm notice 
#0 6.441 npm ERR! code 1
#0 6.441 npm ERR! path /app/node_modules/esbuild
#0 6.441 npm ERR! command failed
#0 6.441 npm ERR! command sh -c node install.js
#0 6.442 npm ERR! node:internal/errors:496
#0 6.442 npm ERR!     ErrorCaptureStackTrace(err);
#0 6.442 npm ERR!     ^
#0 6.442 npm ERR! 
#0 6.442 npm ERR! <ref *1> Error: spawnSync /app/node_modules/esbuild/bin/esbuild ETXTBSY
#0 6.442 npm ERR!     at Object.spawnSync (node:internal/child_process:1117:20)
#0 6.442 npm ERR!     at spawnSync (node:child_process:871:24)
#0 6.442 npm ERR!     at Object.execFileSync (node:child_process:914:15)
#0 6.442 npm ERR!     at validateBinaryVersion (/app/node_modules/esbuild/install.js:98:28)
#0 6.442 npm ERR!     at /app/node_modules/esbuild/install.js:285:5 {
#0 6.442 npm ERR!   errno: -26,
#0 6.442 npm ERR!   code: 'ETXTBSY',
#0 6.442 npm ERR!   syscall: 'spawnSync /app/node_modules/esbuild/bin/esbuild',
#0 6.442 npm ERR!   path: '/app/node_modules/esbuild/bin/esbuild',
#0 6.442 npm ERR!   spawnargs: [ '--version' ],
#0 6.442 npm ERR!   error: [Circular *1],
#0 6.442 npm ERR!   status: null,
#0 6.442 npm ERR!   signal: null,
#0 6.442 npm ERR!   output: null,
#0 6.442 npm ERR!   pid: 0,
#0 6.442 npm ERR!   stdout: null,
#0 6.443 npm ERR!   stderr: null
#0 6.443 npm ERR! }
#0 6.443 npm ERR! 
#0 6.443 npm ERR! Node.js v20.3.0
#0 6.443 
#0 6.443 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-06-13T03_18_04_432Z-debug-0.log

I tried clearing the Docker cache and removing any linked node_modules directory but the problem persists. I can reproduce this locally and in CI.

2

Answers


  1. Try to write the version of the image in the dockerfile
    It helped me

    FROM --platform=linux/amd64 node:19.5.0
    
    Login or Signup to reply.
  2. I was using node:20.3.0-bullseye-slim as a base imageĀ and fixed the issue by rollbacking to a previous version (node:20.2.0-bullseye-slim).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search