WiseLibs / better-sqlite3

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

I am not able to install better-sqlite3 and giving me the error #1215

Closed Tenzijn closed 3 days ago

Tenzijn commented 3 days ago

npm ERR! code 1 npm ERR! command failed npm ERR! command sh -c prebuild-install || node-gyp rebuild --release npm ERR! TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate npm ERR! ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate npm ERR! TOUCH Release/obj.target/deps/locate_sqlite3.stamp npm ERR! CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o npm ERR! LIBTOOL-STATIC Release/sqlite3.a npm ERR! CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o npm ERR! rm ba23eeee118cd63e16015df367567cb043fed872.intermediate npm ERR! prebuild-install warn install No prebuilt binaries found (target=21.6.2 runtime=node arch=arm64 libc= platform=darwin) npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@8.4.1 npm ERR! gyp info using node@21.6.2 | darwin | arm64 npm ERR! gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3" npm ERR! gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'make', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/bodtsang/Library/Caches/node-gyp/21.6.2', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Volumes/Tenzijn M.2/Programming/GitHub/Tenzijn/foodies/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/bodtsang/Library/Caches/node-gyp/21.6.2/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/Volumes/Tenzijn M.2/Programming/GitHub/Tenzijn/foodies/node_modules/better-sqlite3', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp info spawn make npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] npm ERR! In file included from ../src/better_sqlite3.cpp:4: npm ERR! ./src/better_sqlite3.lzz:2:10: fatal error: 'climits' file not found npm ERR! 2 | #include npm ERR! | ^~~~~ npm ERR! 1 error generated. npm ERR! make: *** [Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1 npm ERR! gyp ERR! build error npm ERR! gyp ERR! stack Error: make failed with exit code: 2 npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:519:28) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12) npm ERR! gyp ERR! System Darwin 24.0.0 npm ERR! gyp ERR! node -v v21.6.2 npm ERR! gyp ERR! node-gyp -v v8.4.1 npm ERR! gyp ERR! not ok

neoxpert commented 3 days ago

If you want to use NodeJS 21, you have to ensure, that you have set up a proper build environment for compiling the native module. The node-gyp version stated in the logs is pretty dated. Also it seems that header files are missing (climits.h)

If you don't want to care about setting up the complete build tool chain, I would recommend switching to NodeJS 20 LTS or Node 22 in order to utilize available prebuilt binaries of the latest better-sqlite3 version.

mceachen commented 3 days ago

Closing: we only support current versions of Node.js.