Node-red-node-sqlite Not Installing

I recently upgraded to node-red 3.0.2 and as such, I also upgrade node.js to version 16 and npm to version 8. a couple of my flows had errors afterwards that the sqlite was in need of attention. I tried to upgrade it via the command line and it provides lots of error and then tried from within node-red and the piece below is what is spit out. I read in the forums of a problem having both node-red-node-sqlite sqlite and node-red-node-sqlite sqlitedb installed. I uninstalled the node-red-node-sqlite sqlitedb and still can't get node-red-node-sqlite sqlite to install.

I realize there are lots of the questions about this subject, and I've tried the recommendations in the forums and they are a year or more old.

2022-12-10T00:13:01.983Z Install : node-red-node-sqlite 1.0.3

2022-12-10T00:13:02.002Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-node-sqlite@1.0.3
2022-12-10T00:13:04.501Z [err] npm
2022-12-10T00:13:04.505Z [err]  WARN 
2022-12-10T00:13:04.506Z [err] config production Use `--omit=dev` instead.
2022-12-10T00:13:18.614Z [err] npm
2022-12-10T00:13:18.615Z [err]  WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
2022-12-10T00:13:24.264Z [err] npm
2022-12-10T00:13:24.265Z [err]  
2022-12-10T00:13:24.265Z [err] ERR!
2022-12-10T00:13:24.265Z [err]  
2022-12-10T00:13:24.266Z [err] code
2022-12-10T00:13:24.266Z [err]  1
2022-12-10T00:13:24.267Z [err] npm
2022-12-10T00:13:24.267Z [err]  
2022-12-10T00:13:24.267Z [err] ERR!
2022-12-10T00:13:24.268Z [err]  
2022-12-10T00:13:24.268Z [err] path
2022-12-10T00:13:24.268Z [err]  /home/pi/.node-red/node_modules/sqlite3
2022-12-10T00:13:24.275Z [err] npm
2022-12-10T00:13:24.275Z [err]  
2022-12-10T00:13:24.276Z [err] ERR!
2022-12-10T00:13:24.276Z [err]  command failed
2022-12-10T00:13:24.277Z [err] npm
2022-12-10T00:13:24.277Z [err]  
2022-12-10T00:13:24.278Z [err] ERR!
2022-12-10T00:13:24.278Z [err]  
2022-12-10T00:13:24.278Z [err] command
2022-12-10T00:13:24.279Z [err]  sh -c -- node-pre-gyp install --fallback-to-build
2022-12-10T00:13:24.279Z [err] npm
2022-12-10T00:13:24.280Z [err]  
2022-12-10T00:13:24.280Z [err] ERR!
2022-12-10T00:13:24.280Z [err]  Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
2022-12-10T00:13:24.281Z [err] npm
2022-12-10T00:13:24.282Z [err]  
2022-12-10T00:13:24.282Z [err] ERR!
2022-12-10T00:13:24.283Z [err]  node-pre-gyp info it worked if it ends with ok
2022-12-10T00:13:24.283Z [err] npm
2022-12-10T00:13:24.283Z [err]  
2022-12-10T00:13:24.284Z [err] ERR!
2022-12-10T00:13:24.284Z [err]  node-pre-gyp info using node-pre-gyp@1.0.10
2022-12-10T00:13:24.284Z [err] npm
2022-12-10T00:13:24.285Z [err]  
2022-12-10T00:13:24.285Z [err] ERR!
2022-12-10T00:13:24.286Z [err]  node-pre-gyp info using node@16.18.1 | linux | arm
2022-12-10T00:13:24.286Z [err] npm
2022-12-10T00:13:24.287Z [err]  
2022-12-10T00:13:24.287Z [err] ERR!
2022-12-10T00:13:24.287Z [err]  node-pre-gyp info check checked for "/home/pi/.node-red/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-arm/node_sqlite3.node" (not found)
2022-12-10T00:13:24.288Z [err] npm
2022-12-10T00:13:24.288Z [err]  
2022-12-10T00:13:24.288Z [err] ERR!
2022-12-10T00:13:24.289Z [err]  node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.2/napi-v6-linux-glibc-arm.tar.gz
2022-12-10T00:13:24.289Z [err] npm
2022-12-10T00:13:24.289Z [err]  
2022-12-10T00:13:24.291Z [err] ERR!
2022-12-10T00:13:24.291Z [err]  node-pre-gyp ERR! install response status 404 Not Found on https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.2/napi-v6-linux-glibc-arm.tar.gz 
2022-12-10T00:13:24.292Z [err] npm
2022-12-10T00:13:24.292Z [err]  
2022-12-10T00:13:24.301Z [err] ERR! node-pre-gyp WARN Pre-built binaries not installable for sqlite3@5.1.2 and node@16.18.1 (node-v93 ABI, glibc) (falling back to source compile with node-gyp) 
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.2/napi-v6-linux-glibc-arm.tar.gz 
2022-12-10T00:13:24.301Z [err] npm ERR! node:internal/modules/cjs/loader:988
2022-12-10T00:13:24.301Z [err] npm ERR!   throw err;
2022-12-10T00:13:24.301Z [err] npm ERR!   ^
2022-12-10T00:13:24.301Z [err] npm ERR! 
2022-12-10T00:13:24.301Z [err] npm ERR! Error: Cannot find module 'object-assign'
2022-12-10T00:13:24.301Z [err] npm ERR! Require stack:
2022-12-10T00:13:24.301Z [err] npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/render-template.js
2022-12-10T00:13:24.301Z [err] npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/plumbing.js
2022-12-10T00:13:24.301Z [err] npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/index.js
2022-12-10T00:13:24.301Z [err] npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/npmlog/log.js
2022-12-10T00:13:24.301Z [err] npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js
2022-12-10T00:13:24.301Z [err] npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
2022-12-10T00:13:24.301Z [err] npm ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
2022-12-10T00:13:24.301Z [err] npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:833:27)
2022-12-10T00:13:24.301Z [err] npm ERR!     at Module.require (node:internal/modules/cjs/loader:1057:19)
2022-12-10T00:13:24.301Z [err] npm ERR!     at require (node:internal/modules/cjs/helpers:103:18)
2022-12-10T00:13:24.301Z [err] npm ERR!     at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/render-template.js:4:20)
2022-12-10T00:13:24.301Z [err] npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1155:14)
2022-12-10T00:13:24.301Z [err] npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
2022-12-10T00:13:24.301Z [err] npm ERR!     at Module.load (node:internal/modules/cjs/loader:1033:32)
2022-12-10T00:13:24.301Z [err] npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:868:12)
2022-12-10T00:13:24.301Z [err] npm ERR!     at Module.require (node:internal/modules/cjs/loader:1057:19) {
2022-12-10T00:13:24.301Z [err] npm ERR!   code: 'MODULE_NOT_FOUND',
2022-12-10T00:13:24.301Z [err] npm ERR!   requireStack: [
2022-12-10T00:13:24.301Z [err] npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/render-template.js',
2022-12-10T00:13:24.301Z [err] npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/plumbing.js',
2022-12-10T00:13:24.301Z [err] npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/index.js',
2022-12-10T00:13:24.301Z [err] npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/npmlog/log.js',
2022-12-10T00:13:24.301Z [err] npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js',
2022-12-10T00:13:24.301Z [err] npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
2022-12-10T00:13:24.301Z [err] npm ERR!   ]
2022-12-10T00:13:24.301Z [err] npm ERR! }
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! build error 
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/pi/.node-red/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! System Linux 5.15.76-v7l+
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! command "/usr/bin/node" "/home/pi/.node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! cwd /home/pi/.node-red/node_modules/sqlite3
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! node -v v16.18.1
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
2022-12-10T00:13:24.301Z [err] npm ERR! node-pre-gyp ERR! not ok
2022-12-10T00:13:24.302Z [err] 
2022-12-10T00:13:24.303Z [err] npm ERR!
2022-12-10T00:13:24.303Z [err]  A complete log of this run can be found in:
2022-12-10T00:13:24.303Z [err] npm ERR!     /home/pi/.npm/_logs/2022-12-10T00_13_04_331Z-debug-0.log
2022-12-10T00:13:24.342Z rc=1

Exactly how did you do those tasks?

@pjockey
I tested this on a Raspberry Pi 3 Model B Rev 1.2 using Buster. I installed node-red:

10 Dec 06:02:26 - [info] Node-RED version: v3.0.2
10 Dec 06:02:26 - [info] Node.js  version: v16.18.1

and npm is version 8.19.2:

pi@superpi:~/.node-red $ npm -v
8.19.2
pi@superpi:~/.node-red $

and then, using the cli, changed the directory to .node-red and ran the install:

pi@superpi:~/.node-red $ npm install node-red-node-sqlite

npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs

added 104 packages, and audited 131 packages in 8m

17 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

As you can see it installed fine and my tests show it is running fine.

I then uninstalled node-red-node-sqlite and installed sqlite3

pi@superpi:~/.node-red $ sudo apt install sqlite3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libdav1d3
Use 'sudo apt autoremove' to remove it.
Suggested packages:
  sqlite3-doc
The following NEW packages will be installed:
  sqlite3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 839 kB of archives.
After this operation, 2,278 kB of additional disk space will be used.
Get:1 http://raspbian.mirror.axinja.net/raspbian buster/main armhf sqlite3 armhf 3.27.2-3+deb10u2 [839 kB]
Fetched 839 kB in 1s (621 kB/s)  
Selecting previously unselected package sqlite3.
(Reading database ... 105189 files and directories currently installed.)
Preparing to unpack .../sqlite3_3.27.2-3+deb10u2_armhf.deb ...
Unpacking sqlite3 (3.27.2-3+deb10u2) ...
Setting up sqlite3 (3.27.2-3+deb10u2) ...
Processing triggers for man-db (2.8.5-2) ...
pi@superpi:~/.node-red $ 

It took a while but ran fine. I then reinstalled node-red-node-sqlite (which also took some time):

pi@superpi:~/.node-red $ npm install node-red-node-sqlite
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs

added 104 packages, and audited 131 packages in 8m

17 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
pi@superpi:~/.node-red $ 

and node-red starts fine

pi@superpi:~/.node-red $ node-red
10 Dec 07:14:55 - [info] 

Welcome to Node-RED
===================

10 Dec 07:14:55 - [info] Node-RED version: v3.0.2
10 Dec 07:14:55 - [info] Node.js  version: v16.18.1
10 Dec 07:14:55 - [info] Linux 5.10.103-v7+ arm LE
10 Dec 07:14:58 - [info] Loading palette nodes
10 Dec 07:15:01 - [info] Settings file  : /home/pi/.node-red/settings.js
10 Dec 07:15:01 - [info] Context store  : 'default' [module=memory]
10 Dec 07:15:01 - [info] User directory : /home/pi/.node-red
10 Dec 07:15:01 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Dec 07:15:01 - [info] Flows file     : /home/pi/.node-red/flows.json
10 Dec 07:15:01 - [info] Server now running at http://127.0.0.1:1880/
10 Dec 07:15:01 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

10 Dec 07:15:01 - [info] Starting flows
10 Dec 07:15:01 - [info] Started flows

and after adding a flow using the sqlite node, it is working fine.

1 Like

Node.js was update thru Synaptic and the I ran the bash command from the nodered.org page. The command was ran for the Raspberry Pi.

This directory is not on the Pi.

sudo chown root:root ~/.node-red/settings.js

I ran this command after the install as there was a warning about using the Pi password for using sudo.

I think you mean nodered.org . Could you edit that post please so that the link works.

That was a really bad idea. Change it back to being owned by pi.

What warning is that? I am sure it did not tell you to change the ownership of settings.js
Don't use sudo unless you are sure you should be using it.

Something is messed up on your system, what do these commands show?
apt policy nodejs
apt policy npm

[Edit] Crossed out section about settings.js See post below.

@Colin It’s the warning we now show after an install, after the recent spate of hacks on Node-RED from the internet. The hack was editing the settings file, and making it owned by root stops that.

OK, I had missed that. I am not sure that it won't cause more problems than it cures. Time will tell.

I will amend my post.

No install should touch the settings file. It should be managed by the user. It won’t affect sqlite

Agreed. I wasn't suggesting it was the problem here.

… so why mention it ?

pi@4gbpi:~ $ apt policy nodejs
nodejs:
  Installed: 16.18.1-deb-1nodesource1
  Candidate: 16.18.1-deb-1nodesource1
  Version table:
 *** 16.18.1-deb-1nodesource1 500
        500 https://deb.nodesource.com/node_16.x bullseye/main armhf Packages
        100 /var/lib/dpkg/status
pi@4gbpi:~ $ apt policy npm   
npm:
  Installed: (none)
  Candidate: (none)
  Version table:
pi@4gbpi:~ $

Because it didn't seem like a good idea and I am struggling to make sense of the issue here.

The nodejs install looks ok, do you have any suggestions as to what may be going on? I don't think I have seen it before.

When I run those two comamnds I get a little different result:

pi@superpi:~/.node-red $ apt policy nodejs
nodejs:
  Installed: 16.18.1-deb-1nodesource1
  Candidate: 16.18.1-deb-1nodesource1
  Version table:
 *** 16.18.1-deb-1nodesource1 500
        500 https://deb.nodesource.com/node_16.x buster/main armhf Packages
        100 /var/lib/dpkg/status
     10.24.0~dfsg-1~deb10u2 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
pi@superpi:~/.node-red $ apt policy npm
npm:
  Installed: (none)
  Candidate: 5.8.0+ds6-4+deb10u2
  Version table:
     5.8.0+ds6-4+deb10u2 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
pi@superpi:~/.node-red $ 

the big difference is that this Pi is running Buster and you are running bullseye
@Colin

I am not running anything in particular here. @pjockey is running bullseye.

I would start by trying to fully clean out the old install of the SQLite node. (And sqlite3 library if that was also installed) by using npm uninstall in the .node-red dir. then check the node_modules dir for sqlite3 and node-red-node-sqlite and remove them if still there. Then run npm cache clean —force to clean up the cache and finally re-run just npm install node-red-node-sqlite

1 Like

The node for sqlite is not install and neither of the items are in the /.node-red/node-modules. I also removed the package sqlite3 from the Pi install.
I ran the npm cache clean --force and then tried to install the node-red-node-sqlite with the same results as above.
Now that the sqlite3 was removed, it doesn't even show up in the package manager.

Lets see if it is something to do with what is already in your .node-red folder. Temporarily rename the .node-red folder to something else and restart node-red. That should make a new .node-red folder with empty flows. Check in the editor that that is the case. Then go into the new .node-red folder and run
npm install node-red-node-sqlite
and see what happens.

Just eliminate an issue with Buster vrs Bullseye I flashed a new SD card with Bullseye, then:

sudo apt update 
sudo apt full-upgrade
sudo apt install git
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node16

started NR and installed node-red-node-sqlite with no issues

1 Like