Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation error: No prebuilt binaries found (target=20.3.1 runtime=node arch=arm64 libc= platform=darwin) #1027

Open
typedarray opened this issue Jun 27, 2023 · 7 comments
Labels
flaky-release Issues from GHA not completing prebuilds help wanted installation

Comments

@typedarray
Copy link

I'm can't install better-sqlite3 using the prebuilt binaries on my local machine. My versions are very similar to #1022, but I'm using pnpm.

Here's the original error message:

kevinkoste core % pnpm add better-sqlite3 
 WARN  deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
../..                                    |  +30 +++
../..                                    | Progress: resolved 800, reused 738, downloaded 0, added 0, done
../../node_modules/.pnpm/[email protected]/node_modules/better-sqlite3: Running install script...
 ELIFECYCLE  Command failed.
kevinkoste core % 

I suspected that this was not the full story, so I ran it again using pnpm add better-sqlite3 --reporter ndjson and found the actual error:

{"time":1687901236730,"hostname":"Kevins-MacBook-Pro.local","pid":83779,"level":"debug","name":"pnpm:lifecycle","depPath":"/better-sqlite3/8.4.0","optional":false,"script":"prebuild-install || node-gyp rebuild --release","stage":"install","wd":"/Users/kevinkoste/workspace/ponder/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3"}
{"time":1687901236994,"hostname":"Kevins-MacBook-Pro.local","pid":83779,"level":"debug","name":"pnpm:lifecycle","depPath":"/better-sqlite3/8.4.0","line":"prebuild-install warn install No prebuilt binaries found (target=20.3.1 runtime=node arch=arm64 libc= platform=darwin)","stage":"install","stdio":"stderr","wd":"/Users/kevinkoste/workspace/ponder/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3"}
{"time":1687901236996,"hostname":"Kevins-MacBook-Pro.local","pid":83779,"level":"debug","name":"pnpm:lifecycle","depPath":"/better-sqlite3/8.4.0","line":"sh: node-gyp: command not found","stage":"install","stdio":"stderr","wd":"/Users/kevinkoste/workspace/ponder/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3"}
{"time":1687901236997,"hostname":"Kevins-MacBook-Pro.local","pid":83779,"level":"error","name":"pnpm","code":"ELIFECYCLE","errno":"ENOENT","syscall":"spawn","file":"sh","pkgid":"[email protected]","stage":"install","script":"prebuild-install || node-gyp rebuild --release","pkgname":"better-sqlite3","name":"pnpm","err":{"name":"pnpm","message":"[email protected] install: `prebuild-install || node-gyp rebuild --release`\nspawn ENOENT","code":"ELIFECYCLE","stack":"pnpm: [email protected] install: `prebuild-install || node-gyp rebuild --release`\nspawn ENOENT\n    at ChildProcess.<anonymous> (/snapshot/dist/pnpm.cjs)\n    at ChildProcess.emit (events.js:400:28)\n    at maybeClose (internal/child_process.js:1088:16)\n    at Socket.<anonymous> (internal/child_process.js:446:11)\n    at Socket.emit (events.js:400:28)\n    at Pipe.<anonymous> (net.js:686:12)"}}
prebuild-install warn install No prebuilt binaries found (target=20.3.1 runtime=node arch=arm64 libc= platform=darwin)

Any idea why it's not finding the prebuilt binary? My understanding is that there is a prebuilt binary matching (target=20.3.1 runtime=node arch=arm64 libc= platform=darwin) for [email protected].

@neoxpert
Copy link
Contributor

neoxpert commented Jun 28, 2023

Just out of curiosity: Does it work if you use npm / yarn? Just to remove pnpm from the checklist.

Regarding the log lines it does not look like an issue with better-sqlite3 itself but a problem on the target machine or somewhere in the involved utility libs for looking up / loading the prebuilt binaries. I'm not that used to the MacOS eco system, but "code":"ELIFECYCLE","errno":"ENOENT","syscall":"spawn","file":"sh" looks like something is not working as it should. ENOENT hints that something was not found / does not exist in the file system.

Also it looks like that node-gyp is missing on your machine as the 3 log line states sh: node-gyp: command not found. What does pnpm list "node-gyp*" give as output? Have you tried installing it manually? Actually there is an open issue about pnpm and node-gyp pnpm/pnpm#4347.

@typedarray
Copy link
Author

Thanks for the response. I did some more digging:

  1. pnpm list "node-gyp*" indeed returned nothing. I tried installed node-gyp manually and then was able to install [email protected] successfully. This seems to confirm the pnpm issue you linked above.
  2. Interestingly, I was able to install [email protected] successfully before installing node-gyp. I can't tell from the pnpm logs whether it's finding the prebuilt binary in that case or building from source. My guess is that it's building from source.
  3. I am able to install both aforementioned versions of better-sqlite3 using npm. Again, I can't tell if it's using the prebuilt binary there or building from source. It seems like it's building from source (also takes 19s to install).
  4. Installation with Yarn works on Node 18, but not Node 20. It's clear from the logs that it's building from source in both cases.
yarn install better-sqlite@^8.4.0 Node 18 logs (success)
[4/4] 🔨  Building fresh packages...
[1/2] ⡀ better-sqlite3
verbose 19.852559167 prebuild-install warn install No prebuilt binaries found (target=18.16.1 runtime=node arch=arm64 libc= platform=darwin)

> [email protected] build-release
> node-gyp rebuild --release

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/kevinkoste/.nvm/versions/node/v18.16.1/lib/node_modules/npm/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/kevinkoste/workspace/tmp/npm-test/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kevinkoste/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kevinkoste/Library/Caches/node-gyp/18.16.1/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/kevinkoste/Library/Caches/node-gyp/18.16.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/kevinkoste/.nvm/versions/node/v18.16.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/kevinkoste/Library/Caches/node-gyp/18.16.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/kevinkoste/workspace/tmp/npm-test/node_modules/better-sqlite3',
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 spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
  LIBTOOL-STATIC Release/sqlite3.a
  CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
./src/objects/database.lzz:180:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
                int status = sqlite3_db_config(db_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, NULL);
                    ^
1 warning generated.
  SOLINK_MODULE(target) Release/better_sqlite3.node
  CC(target) Release/obj.target/test_extension/deps/test_extension.o
  SOLINK_MODULE(target) Release/test_extension.node
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ [email protected]
info All dependencies
└─ [email protected]
✨  Done in 20.12s.
yarn install better-sqlite@^8.4.0 Node 20 logs (failure)
[4/4] 🔨  Building fresh packages...
[1/2] ⠠ better-sqlite3
verbose 18.645091334 Error: /Users/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3: Command failed.
Exit code: 1
Command: prebuild-install || npm run build-release
Arguments: 
Directory: /Users/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3
Output:
prebuild-install warn install No prebuilt binaries found (target=20.3.1 runtime=node arch=arm64 libc= platform=darwin)

> [email protected] build-release
> node-gyp rebuild --release

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/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/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/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/kevinkoste/Library/Caches/node-gyp/20.3.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3',
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 spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
  LIBTOOL-STATIC Release/sqlite3.a
  CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:24:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-array-buffer.h:12:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-local-handle.h:12:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
SHARED_EXTERNAL_POINTER_TAGS(CHECK_SHARED_EXTERNAL_POINTER_TAGS)
                             ^
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
PER_ISOLATE_EXTERNAL_POINTER_TAGS(CHECK_NON_SHARED_EXTERNAL_POINTER_TAGS)
                                  ^
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:693:61: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(kJSObjectType + 1 == kFirstJSApiObjectType);
                                                            ^
                                                            , ""
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:694:55: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(kJSObjectType < kLastJSApiObjectType);
                                                      ^
                                                      , ""
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:695:63: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(kFirstJSApiObjectType < kLastJSApiObjectType);
                                                              ^
                                                              , ""
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:24:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-array-buffer.h:13:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-object.h:9:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-maybe.h:106:45: error: no template named 'is_lvalue_reference_v' in namespace 'std'; did you mean 'is_lvalue_reference'?
  template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
                                       ~~~~~^~~~~~~~~~~~~~~~~~~~~
                                            is_lvalue_reference
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:910:29: note: 'is_lvalue_reference' declared here
struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
                            ^
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:24:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-array-buffer.h:13:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-object.h:9:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-maybe.h:106:69: error: expected '(' for function-style cast or type construction
  template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-maybe.h:123:43: error: no template named 'is_lvalue_reference_v' in namespace 'std'; did you mean 'is_lvalue_reference'?
template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
                                     ~~~~~^~~~~~~~~~~~~~~~~~~~~
                                          is_lvalue_reference
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:910:29: note: 'is_lvalue_reference' declared here
struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
                            ^
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:24:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-array-buffer.h:13:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-object.h:9:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-maybe.h:123:67: error: expected '(' for function-style cast or type construction
template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:33:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-function.h:11:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-function-callback.h:151:66: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
                kReturnValueDefaultValueIndex - kReturnValueIndex);
                                                                 ^
                                                                 , ""
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-function-callback.h:153:50: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
                kIsolateIndex - kReturnValueIndex);
                                                 ^
                                                 , ""
./src/util/macros.lzz:157:21: error: no member named 'AccessorSignature' in namespace 'v8'
                v8::AccessorSignature::New(isolate, recv)
                ~~~~^
./src/objects/database.lzz:180:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
                int status = sqlite3_db_config(db_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, NULL);
                    ^
./src/util/binder.lzz:37:51: error: no member named 'CreationContext' in 'v8::Object'
                v8::Local<v8::Context> ctx = obj->CreationContext();
                                             ~~~~~^
23 warnings and 6 errors generated.
make: *** [Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:511:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/Users/kevinkoste/.nvm/versions/node/v20.3.1/bin/node" "/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3
gyp ERR! node -v v20.3.1
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
    at ProcessTermError.ExtendableBuiltin (/Users/kevinkoste/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/yarn/lib/cli.js:721:66)
    at ProcessTermError.MessageError (/Users/kevinkoste/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/yarn/lib/cli.js:750:123)
    at new ProcessTermError (/Users/kevinkoste/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/yarn/lib/cli.js:790:113)
    at ChildProcess.<anonymous> (/Users/kevinkoste/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/yarn/lib/cli.js:25787:17)
    at ChildProcess.emit (node:events:511:28)
    at maybeClose (node:internal/child_process:1098:16)
    at Socket.<anonymous> (node:internal/child_process:456:11)
    at Socket.emit (node:events:511:28)
    at Pipe.<anonymous> (node:net:334:12)
error /Users/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3: Command failed.
Exit code: 1
Command: prebuild-install || npm run build-release
Arguments: 
Directory: /Users/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3
Output:
prebuild-install warn install No prebuilt binaries found (target=20.3.1 runtime=node arch=arm64 libc= platform=darwin)

> [email protected] build-release
> node-gyp rebuild --release

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/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/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/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/kevinkoste/Library/Caches/node-gyp/20.3.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3',
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 spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
  LIBTOOL-STATIC Release/sqlite3.a
  CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:24:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-array-buffer.h:12:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-local-handle.h:12:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
SHARED_EXTERNAL_POINTER_TAGS(CHECK_SHARED_EXTERNAL_POINTER_TAGS)
                             ^
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
PER_ISOLATE_EXTERNAL_POINTER_TAGS(CHECK_NON_SHARED_EXTERNAL_POINTER_TAGS)
                                  ^
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:693:61: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(kJSObjectType + 1 == kFirstJSApiObjectType);
                                                            ^
                                                            , ""
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:694:55: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(kJSObjectType < kLastJSApiObjectType);
                                                      ^
                                                      , ""
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-internal.h:695:63: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(kFirstJSApiObjectType < kLastJSApiObjectType);
                                                              ^
                                                              , ""
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:24:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-array-buffer.h:13:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-object.h:9:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-maybe.h:106:45: error: no template named 'is_lvalue_reference_v' in namespace 'std'; did you mean 'is_lvalue_reference'?
  template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
                                       ~~~~~^~~~~~~~~~~~~~~~~~~~~
                                            is_lvalue_reference
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:910:29: note: 'is_lvalue_reference' declared here
struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
                            ^
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:24:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-array-buffer.h:13:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-object.h:9:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-maybe.h:106:69: error: expected '(' for function-style cast or type construction
  template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-maybe.h:123:43: error: no template named 'is_lvalue_reference_v' in namespace 'std'; did you mean 'is_lvalue_reference'?
template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
                                     ~~~~~^~~~~~~~~~~~~~~~~~~~~
                                          is_lvalue_reference
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:910:29: note: 'is_lvalue_reference' declared here
struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
                            ^
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:24:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-array-buffer.h:13:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-object.h:9:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-maybe.h:123:67: error: expected '(' for function-style cast or type construction
template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/node.h:73:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8.h:33:
In file included from /Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-function.h:11:
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-function-callback.h:151:66: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
                kReturnValueDefaultValueIndex - kReturnValueIndex);
                                                                 ^
                                                                 , ""
/Users/kevinkoste/Library/Caches/node-gyp/20.3.1/include/node/v8-function-callback.h:153:50: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
                kIsolateIndex - kReturnValueIndex);
                                                 ^
                                                 , ""
./src/util/macros.lzz:157:21: error: no member named 'AccessorSignature' in namespace 'v8'
                v8::AccessorSignature::New(isolate, recv)
                ~~~~^
./src/objects/database.lzz:180:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
                int status = sqlite3_db_config(db_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, NULL);
                    ^
./src/util/binder.lzz:37:51: error: no member named 'CreationContext' in 'v8::Object'
                v8::Local<v8::Context> ctx = obj->CreationContext();
                                             ~~~~~^
23 warnings and 6 errors generated.
make: *** [Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:511:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/Users/kevinkoste/.nvm/versions/node/v20.3.1/bin/node" "/Users/kevinkoste/.nvm/versions/node/v20.3.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/kevinkoste/workspace/tmp/npm-test/node_modules/@ponder/core/node_modules/better-sqlite3
gyp ERR! node -v v20.3.1
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok

Questions:

  1. It seems clear that the prebuilt binaries are not being found for any of the package managers. Any idea why? It really seems like my platform should be supported. The Yarn/Node 18 logs show a warning from prebuild-install that doesn't make sense to me: verbose 19.852559167 prebuild-install warn install No prebuilt binaries found (target=18.16.1 runtime=node arch=arm64 libc= platform=darwin).
  2. For a given installation, is there any way to tell if the prebuilt binary is being used or if it was built from source? Perhaps by inspecting the files in node_modules/better-sqlite3?

@neoxpert
Copy link
Contributor

Well regarding the observation of point 4: That is correct and expected. There have been changes in the Node API and the required adjustments were introduced with [email protected]. For version 7.6.2 there are no prebuilt binaries available for the combination of arm64 and darwin. What makes it strange, because you said, that you were able to install it before installing node-gyp?

Afaik there is no other way than looking in the install output to determine if a prebuilt module is being used or if it was built from source - beside afterwards checking if there are any other files present under node_modules/better-slite3/build/Release than the better_sqlite3.node file.

@typedarray
Copy link
Author

typedarray commented Jun 28, 2023

What makes it strange, because you said, that you were able to install it before installing node-gyp?

EDIT: This is indeed strange. I have a hunch that (many months ago) I built better-sqlite3 from source on my machine, and it was added to the pnpm cache/store. And then at some point I may have uninstalled node-gyp.

Thanks for the tip on checking node_modules/better-slite3/build/Release. There are other files present in that dir everywhere I've tried to install it, so (as expected) it's being built from source in every case.

Any idea why prebuild-install is not able to find the prebuilt binaries for my machine? Or how I can debug this further?

@neoxpert
Copy link
Contributor

neoxpert commented Jul 1, 2023

Well which prebuilts? If you are still trying to use 7.6.2 -> There are none available for your machine architecture. If prebuilt-install does not find prebuilt binaries for 8.4.0 that would be strange and I don't think it could be solved by better-sqlite3 alone. So far I did not encounter this issue on multiple automated build platforms (win x64, darwin x64 and darwin arm64).

@ImSingee
Copy link

ImSingee commented Jul 5, 2023

For a workaround, just run pnpm install -g node-gyp before install better-sqlite3.

@Wolfr
Copy link

Wolfr commented Jul 21, 2023

@ImSingee running this command first helped me out of a pickle when installing supabase, which also seems to depend on better-sqlite3 (in a Sveltekit context). Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-release Issues from GHA not completing prebuilds help wanted installation
Development

No branches or pull requests

6 participants