X-Press Publishing - npm install sqlite3 not loading in node_module folder

I’ve looked in many locations and tired what feels like almost everything. There have been similar posts, but what was suggested hasn’t worked. I’m kinda blindly trying things. Maybe it’s new? Perhaps I just need help understanding what exactly the errors mean to problem solve in the future. Sqlite3 won’t install in the node_modules folder.

I’m using a chromebook/linux.

package.json

    {
  "name": "x-press-publishing",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "test": "mocha"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "chai": "^4.1.2",
    "mocha": "^3.5.0",
    "random-flat-colors": "^1.0.4",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-router-dom": "^4.2.2",
    "sqlite3": "^3.1.9",
    "supertest": "^3.0.0",
    "whatwg-fetch": "^2.0.3"
  },
  "devDependencies": {
    "babel": "^6.23.0",
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",
    "webpack": "^3.5.5"
  }
}

Here are my versions of node, npm and sqlite3:

...@penguin:~$ sqlite3
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .exit^Z
[1]+  Stopped                 sqlite3

...@penguin:~$ node -v
v14.15.0

...@penguin:~$ npm -v
6.14.8

and here is the error.

./src/database.cc: At global scope:
../src/database.cc:689:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/node_sqlite3/src/database.o.d.raw: No such file or directory
compilation terminated.
make: *** [node_sqlite3.target.mk:131: Release/obj.target/node_sqlite3/src/database.o] Error 1
make: Leaving directory '/home/.../Coding Projects/Web Development/Teest/node_modules/sqlite3/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.4.67-09356-gf3ed4c0c4a31
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/.../Coding Projects/Web Development/Teest/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/.../Coding Projects/Web Development/Teest/node_modules/sqlite3/lib/binding/node-v83-linux-x64"
gyp ERR! cwd /home/.../Coding Projects/Web Development/Teest/node_modules/sqlite3
gyp ERR! node -v v14.15.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@3.1.13 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sqlite3@3.1.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/.../.npm/_logs/2020-10-31T18_44_25_536Z-debug.log

I remember running into a problem like this on the project too. The solutions were to either downgrade to an older version of node, install a node version manager and switch to an older version, or to use a newer version of sqlite3 for the project.

I used the last option because of this post: Problem installing sqlite3

This worked perfectly for me after making the change in package.json and running npm install . Nothing else in the project needed to be adjusted to complete.

Just so I/others can do this in the future, can you direct where that information can be found on that weebsite? That 4.1.1 is the latest one?

No, the latest one is 5.0.0, which was released 4 months ago. By searching for sqlite3 in npmjs.com, you can see the information about it:

There is a versions tab that will give a timeline too. Most likely 5.0.0 would be fine in this project as well, but I haven’t tested it myself.

1 Like

My solution was just to uninstall sqlite3 and then reinstall it with NPM.