英文:
ETXTBSY error when installing esbuild in Docker container
问题
在Docker构建过程中尝试安装npm包"esbuild"时,遇到了错误。先前构建是正常的,最近没有进行重大更改。但是,构建现在失败,显示以下错误消息:
=> 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 npm@9.7.1` 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
我尝试清除Docker缓存并删除任何链接的node_modules目录,但问题仍然存在。我可以在本地和CI中重现这个问题。
英文:
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 npm@9.7.1` 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.
答案1
得分: 8
我使用了node:20.3.0-bullseye-slim
作为基础镜像,并通过回滚到以前的版本(node:20.2.0-bullseye-slim
)来解决了问题。
英文:
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
).
答案2
得分: 0
尝试在Dockerfile中编写图像的版本
它帮助了我
FROM --platform=linux/amd64 node:19.5.0
英文:
Try to write the version of the image in the dockerfile
It helped me
FROM --platform=linux/amd64 node:19.5.0
答案3
得分: 0
I had encountered the same error
我遇到了相同的错误
I'm using node:20.3-alpine3.18 but i didn't want to rollback to a different version because it was running on any other machine.
我使用的是 node:20.3-alpine3.18,但我不想回滚到不同的版本,因为它在其他任何机器上都能运行。
However, I had some features from Docker Desktop activated, including 'Use Rosetta for x86/amd64 emulation...' on my M1 Mac.
然而,我启用了 Docker Desktop 的一些功能,包括在我的 M1 Mac 上启用 'Use Rosetta for x86/amd64 emulation...'。
I decided to disable the 'Use Rosetta' option in Docker Desktop.
After disabling 'Use Rosetta for x86/amd64 emulation...', I rebuilt my Docker container, and the build process ran smoothly without any file locking issues. My npm packages were installed correctly, and the project is up and running again. I hope this solution proves beneficial to anyone encountering a similar issue.
我决定在 Docker Desktop 中禁用 'Use Rosetta' 选项。在禁用 'Use Rosetta for x86/amd64 emulation...' 后,我重建了我的 Docker 容器,构建过程顺利进行,没有任何文件锁定问题。我的 npm 包被正确安装,项目又重新运行了起来。我希望这个解决方案对任何遇到类似问题的人都有帮助。
英文:
I had encountered the same error
I'm using node:20.3-alpine3.18 but i didn't want to rollback to a different version because it was running on any other machine.
16.96 npm ERR! <ref *1> Error: spawnSync /app/node_modules/esbuild/bin/esbuild ETXTBSY
...
npm ERR! errno: -26,
npm ERR! code: 'ETXTBSY',
npm ERR! syscall: 'spawnSync /app/node_modules/esbuild/bin/esbuild',
npm ERR! path: '/app/node_modules/esbuild/bin/esbuild',
...
However, I had some features from Docker Desktop activated, including 'Use Rosetta for x86/amd64 emulation...' on my M1 Mac.
I decided to disable the 'Use Rosetta' option in Docker Desktop.
After disabling 'Use Rosetta for x86/amd64 emulation...', I rebuilt my Docker container, and the build process ran smoothly without any file locking issues. My npm packages were installed correctly, and the project is up and running again. I hope this solution proves beneficial to anyone encountering a similar issue.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论