WiseLibs / better-sqlite3

The fastest and simplest library for SQLite3 in Node.js.
MIT License
5.37k stars 394 forks source link

Error while installation #1020

Closed bhsrampage closed 1 year ago

bhsrampage commented 1 year ago

yarn install v1.22.19 [1/4] πŸ” Resolving packages... [2/4] 🚚 Fetching packages... [3/4] πŸ”— Linking dependencies... warning " > @react-native-seoul/masonry-list@1.4.1" has unmet peer dependency "expo@*". warning "react-native > react-native-codegen > jscodeshift@0.13.1" has unmet peer dependency "@babel/preset-env@^7.1.6". warning " > react-native-crypto@2.2.0" has unmet peer dependency "react-native-randombytes@>=2.0.0 <4.0.0". warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta". [4/4] πŸ”¨ Building fresh packages... [-/10] β „ waiting... [2/10] β „ better-sqlite3 [-/10] β „ waiting... [-/10] β „ waiting... error /Users/burhanuddinsavliwala/Developer/Divytech/offer-nft/node_modules/better-sqlite3: Command failed. Exit code: 1 Command: prebuild-install || npm run build-release Arguments: Directory: /Users/burhanuddinsavliwala/Developer/Divytech/offer-nft/node_modules/better-sqlite3 Output: prebuild-install warn install Request timed out

better-sqlite3@7.6.2 build-release node-gyp rebuild --release

gyp info it worked if it ends with ok gyp info using node-gyp@9.3.1 gyp info using node@20.2.0 | darwin | arm64 gyp info find Python using Python version 3.11.3 found at "/opt/homebrew/opt/python@3.11/bin/python3.11" gyp info spawn /opt/homebrew/opt/python@3.11/bin/python3.11 gyp info spawn args [ gyp info spawn args '/opt/homebrew/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/burhanuddinsavliwala/Developer/Divytech/offer-nft/node_modules/better-sqlite3/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0', gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/Users/burhanuddinsavliwala/Developer/Divytech/offer-nft/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/node.h:73: In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8.h:24: In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-array-buffer.h:12: In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-local-handle.h:12: /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:465:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-internal.h:466:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/node.h:73: In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8.h:24: In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-array-buffer.h:13: In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-object.h:9: /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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>*>


                                            is_lvalue_reference
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_reference.h:26: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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/node.h:73:
In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8.h:24:
In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-array-buffer.h:13:
In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-object.h:9:
/Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_reference.h:26: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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/node.h:73:
In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8.h:24:
In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-array-buffer.h:13:
In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-object.h:9:
/Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/node.h:73:
In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8.h:33:
In file included from /Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/include/node/v8-function.h:11:
/Users/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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/burhanuddinsavliwala/Library/Caches/node-gyp/20.2.0/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 (/opt/homebrew/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 22.5.0
gyp ERR! command "/opt/homebrew/Cellar/node/20.2.0/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/burhanuddinsavliwala/Developer/Divytech/offer-nft/node_modules/better-sqlite3
gyp ERR! node -v v20.2.0

System Config:
System:
    OS: macOS 13.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 438.70 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.2.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.6.6 - /opt/homebrew/bin/npm
    Watchman: 2023.05.22.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.10121639
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.19 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.68.5 => 0.68.5
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
neoxpert commented 1 year ago

You are trying to use an outdated version of better-sqlite3 (v7.6.2) which lacks several adjustments to run / compile on MacOS with arm64. Please use the latest version of better-sqlite3 8.4.0 to make use of the prebuilt binary for MacOS.

bhsrampage commented 1 year ago

You are trying to use an outdated version of better-sqlite3 (v7.6.2) which lacks several adjustments to run / compile on MacOS with arm64. Please use the latest version of better-sqlite3 8.4.0 to make use of the prebuilt binary for MacOS.

Actualy its a part of my projects dependency tree which goes as follows @walletconnect/react-native-dapp -> keyvaluestorage -> better-sqlite3

neoxpert commented 1 year ago

Well then either notify that project to update its dependencies or make use of yarns capabilities to load specific module versions and load the latest better-sqlite3 release. Should be possible as there have been no changes to the better-sqlite3 API itself.

There is no way to retroactive make version 7.6.2 compile on MacOS with arm64 without manually backporting the changes included in the later versions.

bhsrampage commented 1 year ago

Thank you. Specifying the newer version of this package under "resolutions" key in package.json helped solve the issue

For yarn : "resolutions": { "better-sqlite3": "^8.4.0" },

For npm :

"overrides": { "better-sqlite3": "^8.4.0" },