esbuild: Esbuild fails after upgrading from Node 20.2 to 20.3

For my django-base-site project dependabot alerted that there was a new version of Node and created a PR to upgrade from 20.2 to 20.3. The build seems to work in the Github Actions environment, however when I try to run docker compose build nod locally on my MacBook Pro M1 the build fails with the following error.

It’s weird to me that the build passes in Github Actions environment using Docker, but not on my MacBook Pro using Docker. I’m using the latest version of Docker 4.20.1 (110738).

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

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 24 (4 by maintainers)

Most upvoted comments

It looks like this problem has already been reported to the people that maintain the Docker image for node: https://github.com/nodejs/docker-node/issues/1912. I’m closing this issue because this doesn’t appear to be a problem with esbuild. That other issue is likely a better place for this discussion.

My guess would be that it’s due to the libuv 1.45.0 update in https://github.com/nodejs/node/pull/48078, which has a huge changelog and mentions Linux filesystem improvements, likely affecting esbuild.

Same issue here building a new Laravel app in Docker.

package.json:

{
    "private": true,
    "type": "module",
    "scripts": {
        "dev": "vite",
        "build": "vite build"
    },
    "devDependencies": {
        "@tailwindcss/forms": "^0.5.2",
        "alpinejs": "^3.4.2",
        "autoprefixer": "^10.4.2",
        "axios": "^1.1.2",
        "laravel-vite-plugin": "^0.7.5",
        "postcss": "^8.4.6",
        "tailwindcss": "^3.1.0",
        "vite": "^4.0.0"
    }
}

Dockerfile:

FROM node as frontend
COPY [...]
RUN npm install

Result:

#0 8.719 npm ERR! code 1
#0 8.719 npm ERR! path /app/node_modules/esbuild
#0 8.722 npm ERR! command failed
#0 8.722 npm ERR! command sh -c node install.js
#0 8.722 npm ERR! node:internal/errors:496
#0 8.722 npm ERR!     ErrorCaptureStackTrace(err);
#0 8.722 npm ERR!     ^
#0 8.722 npm ERR! 
#0 8.722 npm ERR! <ref *1> Error: spawnSync /app/node_modules/esbuild/bin/esbuild ETXTBSY
#0 8.722 npm ERR!     at Object.spawnSync (node:internal/child_process:1117:20)
#0 8.722 npm ERR!     at spawnSync (node:child_process:871:24)
#0 8.722 npm ERR!     at Object.execFileSync (node:child_process:914:15)
#0 8.722 npm ERR!     at validateBinaryVersion (/app/node_modules/esbuild/install.js:98:28)
#0 8.722 npm ERR!     at /app/node_modules/esbuild/install.js:285:5 {
#0 8.722 npm ERR!   errno: -26,
#0 8.722 npm ERR!   code: 'ETXTBSY',
#0 8.722 npm ERR!   syscall: 'spawnSync /app/node_modules/esbuild/bin/esbuild',
#0 8.722 npm ERR!   path: '/app/node_modules/esbuild/bin/esbuild',
#0 8.722 npm ERR!   spawnargs: [ '--version' ],
#0 8.722 npm ERR!   error: [Circular *1],
#0 8.722 npm ERR!   status: null,
#0 8.722 npm ERR!   signal: null,
#0 8.722 npm ERR!   output: null,
#0 8.722 npm ERR!   pid: 0,
#0 8.722 npm ERR!   stdout: null,
#0 8.722 npm ERR!   stderr: null
#0 8.722 npm ERR! }
#0 8.722 npm ERR! 
#0 8.722 npm ERR! Node.js v20.3.0
#0 8.725 
#0 8.725 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-06-12T11_49_33_700Z-debug-0.log

Specifying node:20.2 in my Dockerfile works