Problem installing sqlite3

Hi, I’m working on the x-press-publishing project in the Building a persistent API module:

when I run ‘npm install’ to install the dependencies, I getting errors that point to a problem with sqlite3:

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.16.3 (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.16.3 (node-v64 ABI) (falling back to source compile with node-gyp)

node-pre-gyp ERR! stack at ChildProcess. (/Users/acandael/Tutorials/x-press-publishing/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Darwin 18.7.0
node-pre-gyp ERR! command “/Users/acandael/.nvm/versions/node/v10.16.3/bin/node” “/Users/acandael/Tutorials/x-press-publishing/node_modules/sqlite3/node_modules/.bin/node-pre-gyp” “install” “–fallback-to-build”
node-pre-gyp ERR! cwd /Users/acandael/Tutorials/x-press-publishing/node_modules/sqlite3
node-pre-gyp ERR! node -v v10.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok

I tried several things like changing my node version to v10.16.3 , but nothing seems to solve my problem.

Has someone experience with this issue? How can I fix it?

thanks for your help,

Anthony

5 Likes

The problem seems to be related to this:

node-pre-gyp install --fallback-to-build

2 Likes

phew, after searching for 2 days for a fix, I finally solved the issue by rolling back to Node v9.11.1

11 Likes

Hey Anthony -

Thanks for your post, I had the exact same issue so this saved me a lot of time figuring out what was wrong. Codecademy should include some sort of warning on this.

Anyway, used a node version manager tool (here) that works perfectly and lets you dynamically change your node version to be used.

Jeroen

3 Likes

I have the same issue, i can’t believe that something such important is not warning anywhere… thank you guys

1 Like

Hey Y’all,
I’m having the same issue with this project. Is anyone using a nvm for mac? If so, can you recommend a link for the nvm so i can install sqlite3?
Not sure I really understand how nvm and node live side by side on my cpu…
j

1 Like

For Windows10 I had to uninstall node and installed again v9.11.1 from https://nodejs.org/en/download/releases/ and after npm install worked.

1 Like

Instead of changing the node version, try to change the sqlite version in package.json:
for me

“sqlite3”: “^4.1.1”

worked perfectly (4.1.1 is the latest sqlite version on npmjs.com). After this, just run npm install again.

27 Likes

Thank you @patrick1238558746048!
That seems to have solved the problem very easily. How did you know to do this?

Thanks, again!

1 Like

I read something on the internet that the problem is related to compatibility problems of node and sqlite so I thought about just using a newer version of sqlite instead of deinstalling node and downloading an earlier node version. Other codecademy-projects seem to already have a newer sqlite version included in package.json!

2 Likes

Thanks for letting me know.

Can you help me? How did you fix it?

This worked for me as well.

made guide here

Thank you Patrick. You saved me.

I just run these to codes:

npm install https://github.com/mapbox/node-sqlite3/tarball/master

then

npm install sqlite3

After it the problem solved.

1 Like

Nailed it. Thanks!

There are still a lot of vulnerabilities (66 for me) but running npm audit fix fixed most of them for me.

1 Like

At the time I’m writing this (7/10/2020), the latest version of Node is 14.3.0, but the version of sqlite3 npm tries to install by default is 4.2.0, which only supports up to Node 13. Fortunately, there is a sqlite3 5.0.0 that does support Node 14 available – you just need to tell npm to install it using:

npm install sqlite3@5.0.0

According to the release notes, this latest version of sqlite3 drops support for versions of node older than 10. If you intend to upgrade to it, make sure your Node is an appropriate version as well.

Thank you for this, Saved me a lot

This worked perfectly for me on a Mac, thanks!