Node-red-node-sqlite npm install node-gyp problem

Hi all,

I am currently working with node-red on a raspberry pi 3B+. The problem begins when I try to install node-red-node-sqlite node. This happens when I try to install the nodes from node-red pallete or when I execute 'npm install' through the terminal.

I would really appreciate if someone have experienced to share possible solutions. I've been trying to solve it for a couple days now,

This is the error log:
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

sqlite3@4.2.0 install /home/pi/.node-red/node_modules/sqlite3

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

node-pre-gyp WARN Using needle for node-pre-gyp https download

node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v83-linux-arm.tar.gz

node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.2.0 and node@14.18.1 (node-v83 ABI, glibc) (falling back to source compile with node-gyp)

gyp WARN install got an error, rolling back install

gyp ERR! configure error

gyp ERR! stack Error: read ECONNRESET

gyp ERR! stack at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)

gyp ERR! System Linux 4.19.66-v7+

gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v83-linux-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v83-linux-arm" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"

gyp ERR! cwd /home/pi/.node-red/node_modules/sqlite3

gyp ERR! node -v v14.18.1

gyp ERR! node-gyp -v v5.1.0

gyp ERR! not ok

node-pre-gyp ERR! build error

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 configure --fallback-to-build --module=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v83-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v83-linux-arm --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)

node-pre-gyp ERR! stack at ChildProcess. (/home/pi/.node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)

node-pre-gyp ERR! stack at ChildProcess.emit (events.js:400:28)

node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1058:16)

node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)

node-pre-gyp ERR! System Linux 4.19.66-v7+

node-pre-gyp ERR! command "/usr/bin/node" "/home/pi/.node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"

node-pre-gyp ERR! cwd /home/pi/.node-red/node_modules/sqlite3

node-pre-gyp ERR! node -v v14.18.1

node-pre-gyp ERR! node-pre-gyp -v v0.11.0

node-pre-gyp ERR! not ok

Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v83-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v83-linux-arm --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! sqlite3@4.2.0 install: node-pre-gyp install --fallback-to-build

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the sqlite3@4.2.0 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/pi/.npm/_logs/2021-10-20T16_30_48_019Z-debug.log

Welcome to the forum @Josari

Are you running under a corporate (or other) firewall of some sort? Or is your internet connection unstable?

It is under a corporate firewall but I was able to install sqlite before without any problem in the same raspberry.

How did you install node-red? Did you use the recommended script?

If not then I suggest you run the script to make sure you have a consistent set of s/w.

However, before that run
sudo apt update
sudo apt full-upgrade
to make sure your system is up to date.

also can you show us the command you used to install the node-red-node-sqlite node from the terminal ?

what strikes me as strange from the error log is that it tries to install version sqlite3@4.2.0
but the sqlite node was updated recently and its sqlite dependency is "sqlite3": "^5.0.2"

the correct command to install the node is
npm i --unsafe-perm node-red-node-sqlite
from your Node-RED user directory - typically ~/.node-red
(source)

I used the recommended script to install node-red. I used "sudo apt updtate" and "sudo apt full-upgrade".

The way I tried to install it from terminal was by a "npm install". I incuded node-red-node-sqllite on my package.json.

I've just tried npm i --unsafe-perm node-red-node-sqlite but the result is the same.

What did you add to package.json and why did you not just use npm to install it?

The project I'm working on uses more nodes, so this is my package.json.

"name": "node-red-project",
"description": "initially created for you by Node-RED 2.1.0 ",
"version": "0.0.1",
"private": true,
"dependencies": {
"node-red-contrib-bcrypt": "0.0.49",
"node-red-contrib-cip-ethernet-ip": "~1.1.2",
"node-red-contrib-ip": "~1.0.1",
"node-red-contrib-modbus": "~5.13.2",
"node-red-contrib-mssql-plus": "~0.5.1",
"node-red-contrib-omron-fins": "~0.1.3",
"node-red-contrib-s7": "~3.0.0-beta.3",
"node-red-node-sqlite": "^0.6.0"
}
}

The other nodes were installed without any problem but sqlite node didn't when I added t.

Why are you trying to install an ancient version? It is at 1.0.1 now. Unless you need that version delete that line and run the command to install the node.

If that is how you also installed the other nodes then you might have old versions of those too.

When I tried to download it from node-red's pallete the version I was trying to download was in fact the newest one (1.0.1) but I had the same problem on my log.

I've just changed the version in my package.json to 1.0.1 and the result is the same.

Why? Remove it from package.json and let npm do it.

What do these show
node -v
npm -v

And show us the full output from the npm command, including the command you enter.

I removed every node from package.json and executed the following commands:

pi@raspberrypi3:~/.node-red $ npm install
removed 223 packages in 10.976s
found 0 vulnerabilities

pi@raspberrypi3:~/.node-red $ node -v
v14.18.1

npm -v
6.14.15

npm i --unsafe-perm node-red-node-sqlite
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated request@2.88.2: request has been deprecated, see Request’s Past, Present and Future · Issue #3142 · request/request · GitHub
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See There’s Math.random(), and then there’s Math.random() · V8 for details.

sqlite3@5.0.2 install /home/pi/.node-red/node_modules/sqlite3
node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403)
node-pre-gyp WARN Pre-built binaries not found for sqlite3@5.0.2 and node@14.18.1 (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)
gyp ERR! System Linux 5.10.63-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/.node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /home/pi/.node-red/node_modules/sqlite3
gyp ERR! node -v v14.18.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
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 configure --fallback-to-build --module=/home/pi/.node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack at ChildProcess. (/home/pi/.node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:400:28)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1058:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
node-pre-gyp ERR! System Linux 5.10.63-v7+
node-pre-gyp ERR! command "/usr/bin/node" "/home/pi/.node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/.node-red/node_modules/sqlite3
node-pre-gyp ERR! node -v v14.18.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/.node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/.node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@5.0.2 install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@5.0.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Well I think we are back to the firewall then. Unless anyone else has any ideas. Something is causing the ECONNRESET, which is a network problem of some sort.

Can you temporarily move the pi outside of the corporate network and try again?

This might help, I don't know though. node.js - How to fix gyp-ERR ECONNRESET? - Stack Overflow

I don't think this is the problem, but have you installed the build tools
sudo apt install build-essential git curl

and maybe do a npm cache clean --force in case there are traces of the old build in there.

Hi all,
I'm back with an update.
I did some tests on different raspberry's.

I used the following commands on a raspberry 4 and a raspberry 3b+ that are not in the same network the other is.

sudo apt update
sudo apt full-upgrade
sudo apt install build-essential git curl
And the recommended installation.

On both raspberries I had no problem when installing sqlite.
Is there any way to evade whatever the corporate firewall could be blocking?