Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Introducing the Project

Error installing sqlite3

Hi folks, I've been running into the same error as many others when trying to install the dependencies for this project: everything seems to install OK (with deprecation warnings), but once the process gets to sqlite3, I get a bunch of errors and it never seems to install.

I've tried all the tips I could find posted in response to similar questions on here: deleting my node_modules folder and running npm install again, running npm audit fix --force, deleting the "sqlite3" from the list of dependencies in the packages.json file and installing it manually (both with specific version numbers and without), installing all the dependencies manually, and none of these has solved my problem. I've deleted the project files entirely and started from scratch twice now.

Here's what I get as far as errors:

npm ERR! code 1
npm ERR! path /Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
npm ERR!   LIBTOOL-STATIC Release/nothing.a
npm ERR!   ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c
npm ERR!   TOUCH Release/obj.target/deps/action_before_build.stamp
npm ERR!   CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3340000/sqlite3.o
npm ERR!   LIBTOOL-STATIC Release/sqlite3.a
npm ERR!   CXX(target) Release/obj.target/node_sqlite3/src/backup.o
npm ERR! Failed to execute '/opt/homebrew/Cellar/node/17.3.1/bin/node /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.11.0
npm ERR! node-pre-gyp info using node@17.3.1 | darwin | arm64
npm ERR! node-pre-gyp WARN Using request for node-pre-gyp https download 
npm ERR! node-pre-gyp info check checked for "/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node" (not found)
npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-darwin-arm64.tar.gz
npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-darwin-arm64.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-darwin-arm64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not found for sqlite3@5.0.2 and node@17.3.1 (node-v102 ABI, unknown) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-darwin-arm64.tar.gz 
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.1 | darwin | arm64
npm ERR! gyp info ok 
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.1 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.8.9 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   '/opt/homebrew/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   '/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/jakeserwin/Library/Caches/node-gyp/17.3.1/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=/Users/jakeserwin/Library/Caches/node-gyp/17.3.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/jakeserwin/Library/Caches/node-gyp/17.3.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/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 ok 
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.1 | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! /bin/sh: Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/build/Release/lib.host:/Users/jakeserwin/Desktop/Coding: No such file or directory
npm ERR! Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c:744:17: warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation]
npm ERR!   "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
npm ERR!                 ^
npm ERR!                ,
npm ERR! Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c:56:27: note: expanded from macro 'CTIMEOPT_VAL'
npm ERR! #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
npm ERR!                           ^
npm ERR! Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c:55:28: note: expanded from macro 'CTIMEOPT_VAL_'
npm ERR! #define CTIMEOPT_VAL_(opt) #opt
npm ERR!                            ^
npm ERR! <scratch space>:5:1: note: expanded from here
npm ERR! "1"
npm ERR! ^
npm ERR! Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c:744:3: note: place parentheses around the string literal to silence warning
npm ERR!   "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
npm ERR!   ^
npm ERR! 1 warning generated.
npm ERR! clang: error: no such file or directory: 'Projects/Techdegree/using-sequelize-orm-with-express/node_modules/node-addon-api'
npm ERR! make: *** [Release/obj.target/node_sqlite3/src/backup.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.onExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 21.1.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/17.3.1/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd /Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3
npm ERR! gyp ERR! node -v v17.3.1
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/opt/homebrew/Cellar/node/17.3.1/bin/node /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3/lib/binding/napi-v3-darwin-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1062:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.1.0
npm ERR! node-pre-gyp ERR! command "/opt/homebrew/Cellar/node/17.3.1/bin/node" "/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3
npm ERR! node-pre-gyp ERR! node -v v17.3.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jakeserwin/.npm/_logs/2022-01-17T22_51_43_227Z-debug-0.log

Is it possible there's something incompatible between the version of node I'm using and sqlite3 or one of the other dependencies? I'd really appreciate some guidance here so I can continue with the course. Thanks everybody.

2 Answers

Brian Jensen
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Brian Jensen
Treehouse Staff

Hiya jakeks :wave:

Based on issue tickets submitted to sqlite3's source code repo, it looks like there is currently an issue with arm64 based CPUs (such as the Apple M1 chip), and having spaces in the install path. It looks like in the error log that you're using an arm64 processor and have a space in part of your install path:

/Users/jakeserwin/Desktop/Coding Projects/Techdegree/using-sequelize-orm-with-express/node_modules/sqlite3

I would recommend renaming this folder in the path: Coding Projects to Coding-Projects or coding-projects. Then try the install again. Let me know if that solves the issue for you! :smiley:

Holy cow Brian Jensen you figured it out! That did the trick for me. This was driving me out of my mind all day yesterday since I couldn't move forward in the course. Thank you so much for digging through all that error information and finding a solution, you're a hero!

Seth Missiaen
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Seth Missiaen
Web Development Techdegree Graduate 21,652 Points

For anyone else who has this issue: If Brian Jensen's fix above did not work, you may want to check and see if your project is located on an external hard drive or something. I had my project on flash drive (on purpose) and moving the project files onto my computer's drive solved the problem.