oven-sh / bun

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

Bun install does not work (when node's node-gyp is missing) #11862

Open heri16 opened 2 weeks ago

heri16 commented 2 weeks ago

What version of Bun is running?

1.1.13+bd6a60512

What platform is your computer?

Darwin 23.5.0 arm64 arm

What steps can reproduce the bug?

  1. Make sure nodejs is not installed (or uninstall node)
  2. bun install argon2@0.31.0

What is the expected behavior?

install succeeds

What do you see instead?

[Scripts] Starting scripts for "argon2"
  🚚 @phc/format... node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using bun@1.0.11
node-pre-gyp info using node@22.2.0 | darwin | arm64
node-pre-gyp info check checked for "/Users/heri/node_modules/argon2/lib/binding/napi-v3/argon2.node" (not found)
node-pre-gyp http GET https://github.com/ranisalt/node-argon2/releases/download/v0.31.0/argon2-v0.31.0-napi-v3-darwin-arm64-unknown.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.31.0/argon2-v0.31.0-napi-v3-darwin-arm64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for argon2@0.31.0 and node@22.2.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.31.0/argon2-v0.31.0-napi-v3-darwin-arm64-unknown.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@22.2.0 | darwin | arm64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@22.2.0 | darwin | arm64
gyp info find Python using Python version 3.12.3 found at "/Users/heri/homebrew/opt/python@3.12/bin/python3.12"

gyp info spawn /Users/heri/homebrew/opt/python@3.12/bin/python3.12
gyp info spawn args [
gyp info spawn args '/private/tmp/bunx-503-node-gyp@latest/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 '/Users/heri/node_modules/argon2/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/private/tmp/bunx-503-node-gyp@latest/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/heri/Library/Caches/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=/Users/heri/Library/Caches/node-gyp/22.2.0',
gyp info spawn args '-Dnode_gyp_dir=/private/tmp/bunx-503-node-gyp@latest/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/heri/Library/Caches/node-gyp/22.2.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/heri/node_modules/argon2',
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 ]
  🚚 @phc/format... 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> (/private/tmp/bunx-503-node-gyp@latest/node_modules/node-gyp/lib/configure.js:297:22)
gyp ERR! stack at emit (node:events:180:48)
gyp ERR! stack at #handleOnExit (node:child_process:591:16)
gyp ERR! stack at processTicksAndRejections (:12:39)
gyp ERR! System Darwin 23.5.0
gyp ERR! command "/Users/heri/.pkgx/bun.sh/v1.1.13/bin/bun" "/private/tmp/bunx-503-node-gyp@latest/node_modules/.bin/node-gyp" "configure" "--fallback-to-build" "--module=/Users/heri/node_modules/argon2/lib/binding/napi-v3/argon2.node" "--module_name=argon2" "--module_path=/Users/heri/node_modules/argon2/lib/binding/napi-v3" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /Users/heri/node_modules/argon2
gyp ERR! node -v v22.2.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp configure --fallback-to-build --module=/Users/heri/node_modules/argon2/lib/binding/napi-v3/argon2.node --module_name=argon2 --module_path=/Users/heri/node_modules/argon2/lib/binding/napi-v3 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at <anonymous> (/Users/heri/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:27)
node-pre-gyp ERR! stack     at emit (node:events:180:48)
node-pre-gyp ERR! stack     at #maybeClose (node:child_process:809:14)
node-pre-gyp ERR! stack     at #handleOnExit (node:child_process:591:16)
node-pre-gyp ERR! stack     at processTicksAndRejections (:12:39)
node-pre-gyp ERR! System Darwin 23.5.0
node-pre-gyp ERR! command "/Users/heri/.pkgx/bun.sh/v1.1.13/bin/bun" "/Users/heri/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/heri/node_modules/argon2
node-pre-gyp ERR! node -v v22.2.0
node-pre-gyp ERR! bun -v v1.0.11
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp configure --fallback-to-build --module=/Users/heri/node_modules/argon2/lib/binding/napi-v3/argon2.node --module_name=argon2 --module_path=/Users/heri/node_modules/argon2/lib/binding/napi-v3 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
error: install script from "argon2" exited with 1

Additional information

Seems like a problem with the node-gyp installed by bunjs (See PR #7622)

If nodejs is installed, bun install argon2@0.31.0 works. See logs below:

[Scripts] Starting scripts for "argon2"
  ⚙️  argon2 [1/1] [PackageManager] waiting for 1 scripts
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.11
node-pre-gyp info using node@22.3.0 | darwin | arm64
(node:99799) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
node-pre-gyp info check checked for "/Users/heri/node_modules/argon2/lib/binding/napi-v3/argon2.node" (not found)
node-pre-gyp http GET https://github.com/ranisalt/node-argon2/releases/download/v0.31.0/argon2-v0.31.0-napi-v3-darwin-arm64-unknown.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.31.0/argon2-v0.31.0-napi-v3-darwin-arm64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for argon2@0.31.0 and node@22.3.0 (node-v127 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.31.0/argon2-v0.31.0-napi-v3-darwin-arm64-unknown.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@22.3.0 | darwin | arm64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@22.3.0 | darwin | arm64
gyp info find Python using Python version 3.12.3 found at "/Users/heri/homebrew/opt/python@3.12/bin/python3.12"

gyp http GET https://nodejs.org/download/release/v22.3.0/node-v22.3.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v22.3.0/node-v22.3.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v22.3.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v22.3.0/SHASUMS256.txt
gyp info spawn /Users/heri/homebrew/opt/python@3.12/bin/python3.12
gyp info spawn args [
gyp info spawn args '/private/tmp/bunx-503-node-gyp@latest/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 '/Users/heri/node_modules/argon2/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/private/tmp/bunx-503-node-gyp@latest/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/heri/Library/Caches/node-gyp/22.3.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=/Users/heri/Library/Caches/node-gyp/22.3.0',
gyp info spawn args '-Dnode_gyp_dir=/private/tmp/bunx-503-node-gyp@latest/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/heri/Library/Caches/node-gyp/22.3.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/heri/node_modules/argon2',
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 info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@22.3.0 | darwin | arm64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/libargon2/argon2/src/ref.o
  CC(target) Release/obj.target/libargon2/argon2/src/argon2.o
  CC(target) Release/obj.target/libargon2/argon2/src/core.o
  CC(target) Release/obj.target/libargon2/argon2/src/blake2/blake2b.o
  CC(target) Release/obj.target/libargon2/argon2/src/thread.o
  CC(target) Release/obj.target/libargon2/argon2/src/encoding.o
  LIBTOOL-STATIC Release/argon2.a
  CXX(target) Release/obj.target/argon2/argon2_node.o
  SOLINK_MODULE(target) Release/argon2.node
  COPY /Users/heri/node_modules/argon2/lib/binding/napi-v3/argon2.node
  TOUCH Release/obj.target/action_after_build.stamp
gyp info ok
node-pre-gyp info ok
VergeDX commented 2 weeks ago

+1

MrOxMasTer commented 1 week ago

image