我正在尝试在docker中使用bun而不是npm。我有bun docker image,但是当我尝试在容器内构建时,错误显示它找不到postcss配置。我将 package.json 设置为 module,并且根文件夹中有 postcss.config.cjs。
#9 0.415 $ bunx --bun vite build
#9 0.895 vite v4.4.9 building for production...
#9 0.913 Failed to load PostCSS config: Failed to load PostCSS config (searchPath: /tmp/frontend): [EBADF] Bad file descriptor
#9 0.913 undefined
#9 0.913 code: "EBADF"
#9 0.913 syscall: "fstat"
#9 0.913 errno: -9
#9 0.913
#9 0.913 Failed to load PostCSS config: Failed to load PostCSS config (searchPath: /tmp/frontend): [EBADF] Bad file descriptor
#9 0.913 undefined
#9 0.913 code: "EBADF"
#9 0.913 syscall: "fstat"
#9 0.913 errno: -9
#9 0.913
#9 0.913 Failed to load PostCSS config: Failed to load PostCSS config (searchPath: /tmp/frontend): [EBADF] Bad file descriptor
#9 0.913 undefined
#9 0.913 code: "EBADF"
#9 0.913 syscall: "fstat"
#9 0.913 errno: -9
#9 0.913
#9 0.913 Failed to load PostCSS config: Failed to load PostCSS config (searchPath: /tmp/frontend): [EBADF] Bad file descriptor
#9 0.913 undefined
#9 0.913 code: "EBADF"
#9 0.913 syscall: "fstat"
#9 0.913 errno: -9
#9 0.913
#9 0.938 transforming...
#9 1.075 ✓ 6 modules transformed.
#9 1.075 ✓ built in 178ms
#9 1.075 [vite:css] Failed to load PostCSS config (searchPath: /tmp/frontend): [EBADF] Bad file descriptor
#9 1.075 undefined
#9 1.075 file: /tmp/frontend/src/css/tables.css
#9 1.075 error during build:
#9 1.075
#9 1.114 error: "vite" exited with code 1 (SIGHUP)
#9 1.115 error: script "build" exited with code 1 (SIGHUP)
当我在 docker 外部尝试时,构建完成。
这是Bun的一个bug。
自1.0.10以来已修复。
https://github.com/oven-sh/bun/issues/4723#issuecomment-1797877188
请使用最新版本检查问题是否仍然存在。
仅供参考,当前最新版本是1.1.0。 Bun正式支持Windows。