oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.02k stars 2.66k forks source link

[Bug]: Error building Docker image due to msgpackr-extract error with Bun #12919

Open marvinkennis opened 1 month ago

marvinkennis commented 1 month ago

What version of Bun is running?

1.1.0 (but happens on latest too)

What platform is your computer?

Mac OS

What steps can reproduce the bug?

Build a docker image with a bun install command in the docker file Include msgpackr-extract or msgpackr as a package or dependency.

What is the expected behavior?

Bun should install msgpackr without issue, just like NPM.

What do you see instead?

Previously, building these docker images worked just fine. I have recently been unable to build the images due to msgpackr-extract causing the following error. I am using bun install. It works just fine when I swap out Bun for npm, which makes me believe the issue here is with Bun.

0.247 bun install v1.1.0 (5903a614) 0.255 Resolving dependencies 9.484 Resolved, downloaded and extracted [3050] 11.52 23 | var uv = (versions.uv || '').split('.')[0] 11.52 24 | 11.52 25 | module.exports = load 11.52 26 | 11.52 27 | function load (dir) { 11.52 28 | return runtimeRequire(load.resolve(dir)) 11.52 ^ 11.52 TypeError: expected module name as a string 11.52 at load (/usr/src/app/node_modules/node-gyp-build-optional-packages/node-gyp-build.js:28:10) 11.52 at /usr/src/app/node_modules/node-gyp-build-optional-packages/build-test.js:19:6 11.52 11.52 The failure above indicates the primary issue with the native builds which are included for all major platforms. Will now attempt to build the package locally in case this can be resolved by re-compiling. 11.52 gyp info it worked if it ends with ok 11.52 gyp info using node-gyp@10.2.0 11.52 gyp info using node@21.6.0 | linux | arm64 11.52 gyp ERR! find Python 11.52 gyp ERR! find Python Python is not set from command line or npm configuration 11.52 gyp ERR! find Python Python is not set from environment variable PYTHON 11.52 gyp ERR! find Python checking if "python3" can be used 11.52 gyp ERR! find Python - "python3" is not in PATH or produced an error 11.52 gyp ERR! find Python checking if "python" can be used 11.52 gyp ERR! find Python - "python" is not in PATH or produced an error 11.52 gyp ERR! find Python 11.52 gyp ERR! find Python ********************************************************** 11.52 gyp ERR! find Python You need to install the latest version of Python. 11.52 gyp ERR! find Python Node-gyp should be able to find and use Python. If not, 11.52 gyp ERR! find Python you can try one of the following options: 11.52 gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable" 11.52 gyp ERR! find Python (accepted by both node-gyp and npm) 11.52 gyp ERR! find Python - Set the environment variable PYTHON 11.52 gyp ERR! find Python - Set the npm configuration variable python: 11.52 gyp ERR! find Python npm config set python "/path/to/pythonexecutable" 11.52 gyp ERR! find Python For more information consult the documentation at: 11.52 gyp ERR! find Python https://github.com/nodejs/node-gyp#installation 11.52 gyp ERR! find Python ********************************************************** 11.52 gyp ERR! find Python 11.52 gyp ERR! configure error 11.52 gyp ERR! stack Error: Could not find any Python installation to use 11.52 gyp ERR! stack at fail (/tmp/bunx-0-node-gyp@latest/node_modules/node-gyp/lib/find-python.js:305:67) 11.52 gyp ERR! stack at processTicksAndRejections (:12:39) 11.52 gyp ERR! System Linux 6.6.16-linuxkit 11.52 gyp ERR! command "/usr/local/bin/bun" "/tmp/bunx-0-node-gyp@latest/node_modules/.bin/node-gyp" "rebuild" 11.52 gyp ERR! cwd /usr/src/app/node_modules/msgpackr-extract 11.52 gyp ERR! node -v v21.6.0 11.52 gyp ERR! node-gyp -v v10.2.0 11.52 gyp ERR! not ok 11.52 11.52 error: install script from "msgpackr-extract" exited with 1

Additional information

No response

marvinkennis commented 1 month ago

This error goes away if I downgrade the bun docker image to 1.0.35

Vinlock commented 2 weeks ago

Yeah I can't use the latest docker image for oven/bun due to this issue.

patriksimms commented 1 week ago

a workaround for me was adding the --ignore-scripts flag to bun install. This will for sure not leverage the native node extension, but msgpackr itself will work

edit: actually I think before 1.1 the lifecycle scripts were not executed, so basically the --ignore-scripts will force the behavior from versions prior 1.1 https://bun.sh/blog/bun-v1.1#lifecycle-scripts

patriksimms commented 1 week ago

Also relevant since msgpackr is mentioned there https://github.com/oven-sh/bun/issues/4290