cheatsheets devlog projects search

better-sqlite3-error.md

Installation issue with better-sqlite3

2022-12-11 1

Ran into an issue where I was trying to install better-sqlite3 and it was building from source. The issue was a lack of memory so I had to give the droplet some swap space so that it could finish the installation.

npm install better-sqlite3

The following is the error:

machine@notesarcana:~/bp/project$ npm install better-sqlite3@latest --build-from-source
npm ERR! path /home/machine/bp/project/node_modules/better-sqlite3
npm ERR! command failed
npm ERR! signal SIGINT
npm ERR! command sh -c prebuild-install || node-gyp rebuild --release
npm ERR! make: Entering directory '/home/machine/bp/project/node_modules/better-sqlite3/build'
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! 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@17.3.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/machine/.nvm/versions/node/v17.3.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
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   '/home/machine/bp/project/node_modules/better-sqlite3/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/machine/.nvm/versions/node/v17.3.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/machine/.cache/node-gyp/17.3.0/include/node/common.gypi',
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=/home/machine/.cache/node-gyp/17.3.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/machine/.nvm/versions/node/v17.3.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/machine/.cache/node-gyp/17.3.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/machine/bp/project/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! make: *** [deps/sqlite3.target.mk:203: Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o] Interrupt
npm ERR! make: *** Deleting intermediate file 'ba23eeee118cd63e16015df367567cb043fed872.intermediate'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/machine/.npm/_logs/2022-12-11T19_46_49_454Z-debug-0.log