1

I'm trying to install sqlite3 in order to develop an express.js backend with sequelize. My operating system is Ubuntu 22.04. My Node version is 18.13.0, npm version 9.3.1.

My current situation is:

>  npm install sqlite3 --save
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm ERR! code 1
npm ERR! path /home/heikki/Koodaus/frostmark/fm-character-sheet/server/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/heikki/.npm/_logs/2023-01-22T13_51_17_296Z-debug-0.log

In the log file, I find this verbose stack trace:

716 verbose stack Error: command failed
716 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
716 verbose stack     at ChildProcess.emit (node:events:513:28)
716 verbose stack     at maybeClose (node:internal/child_process:1091:16)
716 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
717 verbose pkgid sqlite3@5.1.4

Clearing the cache, removing node_modules and package-lock.json, as suggested here and here, and trying to install results in the same issue. In fact, npm cache clean outputs

npm ERR! As of npm@5, the npm cache self-heals from corruption issues
npm ERR!   by treating integrity mismatches as cache misses.  As a result,
npm ERR!   data extracted from the cache is guaranteed to be valid.  If you
npm ERR!   want to make sure everything is consistent, use `npm cache verify`
npm ERR!   instead.  Deleting the cache can only make npm go slower, and is
npm ERR!   not likely to correct any problems you may be encountering!
npm ERR! 
npm ERR!   On the other hand, if you're debugging an issue with the installer,
npm ERR!   or race conditions that depend on the timing of writing to an empty
npm ERR!   cache, you can use `npm install --cache /tmp/empty-cache` to use a
npm ERR!   temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR!   If you're sure you want to delete the entire cache, rerun this command
npm ERR!   with --force.

Trying to install sqlite3@4.1.1, like advised here, also results in the same error.

I have attempted running sudo npm install -g npm node-gyp node-pre-gyp, based on answers here and here

I have also installed libraries via sudo apt install sqlite3 libsqlite3-dev python-is-python3, some of that also suggested by answers to questions I can't track down right now.

What else is there to be done? Is there a way to debug this issue further?

This can be worked around with yarn add sqlite3, as per this answer.

Haem
  • 929
  • 6
  • 15
  • 31
  • You are approaching (probably) the same problem as me in a different way, see: [UNMET DEPENDENCY](https://stackoverflow.com/questions/75042292/nodejs-unmet-dependency-typemodule-how-can-i-get-npm-list-stop-returning-t) – Luuk Jan 22 '23 at 14:24
  • @Luuk Sadly, the answer you got is another permutation of `npm cache clean`, `rm -rf node_modules` and `npm install`. – Haem Jan 22 '23 at 15:59

0 Answers0