oven-sh / bun

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

`re2` installation requires Node.js is present #11405

Open spiffytech opened 1 month ago

spiffytech commented 1 month ago

What version of Bun is running?

1.1.10

What platform is your computer?

Fedora Linux 6.8.9-200.fc39.x86_64

What steps can reproduce the bug?

Try installing the re2 package. Here's a Dockerfile that reproduces:

FROM oven/bun:1.1.10

RUN apt update && apt install -y build-essential python3

RUN bun init -y
RUN bun add re2
STEP 4/4: RUN bun add re2
bun add v1.1.10 (5102a944)
Resolving dependencies
Resolved, downloaded and extracted [352]
No github repository was identified.
Building locally ...

error: 127

Bun v1.1.10 (Linux x64 baseline)
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@22.2.0 | linux | x64
gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
gyp http GET https://nodejs.org/dist/v22.2.0/node-v22.2.0-headers.tar.gz
gyp http 200 https://nodejs.org/dist/v22.2.0/node-v22.2.0-headers.tar.gz
gyp http GET https://nodejs.org/dist/v22.2.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/dist/v22.2.0/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/home/bun/app/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/bun/app/node_modules/re2/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/bun/app/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.cache/node-gyp/22.2.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/22.2.0',
gyp info spawn args '-Dnode_gyp_dir=/home/bun/app/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/22.2.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/bun/app/node_modules/re2',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp: name 'enable_lto' is not defined while evaluating condition 'enable_lto=="true"' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at <anonymous> (/home/bun/app/node_modules/node-gyp/lib/configure.js:296:66)
gyp ERR! stack at emit (node:events:161:48)
gyp ERR! stack at #handleOnExit (node:child_process:591:16)
gyp ERR! stack at processTicksAndRejections (:12:39)
gyp ERR! System Linux 6.8.9-200.fc39.x86_64
gyp ERR! command "/usr/local/bin/bun" "/home/bun/app/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/bun/app/node_modules/re2
gyp ERR! node -v v22.2.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok

error: install script from "re2" exited with 1
Error: building at STEP "RUN bun add re2": while running runtime: exit status 1

What is the expected behavior?

re2 installs

What do you see instead?

Unless Node.js is installed, the node-gyp compile fails.

Additionally, I believe re2 attempts to download precompiled binaries, but cannot do so under Bun for some reason.

Additional information

I was surprised that this didn't work, given re2 installation is demonstrated in the Bun v1.0.19 release blog post.

chicken-suop commented 1 month ago

Same problem with bun install msgpackr

kinton commented 1 month ago

Same problem with bun install

gyp: name 'enable_lto' is not defined while evaluating condition 'enable_lto=="true"' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at <anonymous> (/tmp/bunx-0-node-gyp@latest/node_modules/node-gyp/lib/configure.js:296:66)
gyp ERR! stack at emit (node:events:161:48)
gyp ERR! stack at #handleOnExit (node:child_process:591:16)
gyp ERR! stack at processTicksAndRejections (:12:39)
gyp ERR! System Linux 6.6.12-linuxkit
gyp ERR! command "/usr/local/bin/bun" "/tmp/bunx-0-node-gyp@latest/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /app/node_modules/tree-sitter-yaml
gyp ERR! node -v v22.2.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok

error: install script from "tree-sitter-yaml" exited with 1