Fail to build node-red-node-sqlite

Hello there!
Long time playing around node-red but I never had unknown issues so far, until today...
I was testing few things with node-sqlite in home assistant node-red add on, running on vmware virtual machine. Installed with no issues, running just fine.
Today I tried to migrate it all to a raspberry pi4 but I got an error while building sqlite3 and I have no idea where is main error from the log. Can anybody help me figuring that line out?

pi4 error log:

-----------------------------------------------------------
2021-12-07T12:40:37.048Z Install : node-red-node-sqlite 1.0.1

2021-12-07T12:40:37.209Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-node-sqlite@1.0.1
2021-12-07T12:40:50.661Z [err] npm
2021-12-07T12:40:50.662Z [err]  
2021-12-07T12:40:50.662Z [err] WARN
2021-12-07T12:40:50.662Z [err]  
2021-12-07T12:40:50.663Z [err] deprecated
2021-12-07T12:40:50.663Z [err]  har-validator@5.1.5: this library is no longer supported
2021-12-07T12:40:50.887Z [err] npm
2021-12-07T12:40:50.887Z [err]  
2021-12-07T12:40:50.887Z [err] WARN
2021-12-07T12:40:50.888Z [err]  
2021-12-07T12:40:50.888Z [err] deprecated
2021-12-07T12:40:50.888Z [err]  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 https://v8.dev/blog/math-random for details.
2021-12-07T12:40:50.962Z [err] npm
2021-12-07T12:40:50.963Z [err]  
2021-12-07T12:40:50.963Z [err] WARN
2021-12-07T12:40:50.964Z [err]  
2021-12-07T12:40:50.964Z [err] deprecated
2021-12-07T12:40:50.964Z [err]  request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
2021-12-07T12:40:51.011Z [err] npm
2021-12-07T12:40:51.011Z [err]  
2021-12-07T12:40:51.012Z [err] WARN
2021-12-07T12:40:51.013Z [err]  
2021-12-07T12:40:51.013Z [err] deprecated
2021-12-07T12:40:51.014Z [err]  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
2021-12-07T12:40:51.226Z [err] npm
2021-12-07T12:40:51.226Z [err]  
2021-12-07T12:40:51.227Z [err] WARN
2021-12-07T12:40:51.227Z [err]  
2021-12-07T12:40:51.227Z [err] deprecated
2021-12-07T12:40:51.228Z [err]  tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
2021-12-07T12:40:56.883Z [err] npm 
2021-12-07T12:40:56.883Z [err] ERR! code 1
2021-12-07T12:40:56.883Z [err] npm ERR! path /config/node-red/node_modules/sqlite3
2021-12-07T12:40:56.889Z [err] npm ERR! command failed
2021-12-07T12:40:56.890Z [err] npm ERR! command sh -c node-pre-gyp install --fallback-to-build
2021-12-07T12:40:56.890Z [err] npm ERR! Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/config/node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/config/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)
2021-12-07T12:40:56.890Z [err] npm ERR! node-pre-gyp info it worked if it ends with ok
2021-12-07T12:40:56.890Z [err] npm ERR! node-pre-gyp info using node-pre-gyp@0.11.0
2021-12-07T12:40:56.890Z [err] npm 
2021-12-07T12:40:56.890Z [err] ERR! node-pre-gyp info using node@16.13.1 | linux | arm
2021-12-07T12:40:56.890Z [err] npm ERR! node-pre-gyp WARN Using request for node-pre-gyp https download 
2021-12-07T12:40:56.890Z [err] npm ERR! node-pre-gyp info check checked for "/config/node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node" (not found)
2021-12-07T12:40:56.891Z [err] npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm.tar.gz
2021-12-07T12:40:56.891Z [err] npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm.tar.gz
2021-12-07T12:40:56.891Z [err] npm ERR!
2021-12-07T12:40:56.891Z [err]  node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm.tar.gz 
2021-12-07T12:40:56.891Z [err] npm ERR! node-pre-gyp WARN Pre-built binaries not found for sqlite3@5.0.2 and node@16.13.1 (node-v93 ABI, musl) (falling back to source compile with node-gyp) 
2021-12-07T12:40:56.891Z [err] npm ERR! node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm.tar.gz 
2021-12-07T12:40:56.892Z [err] npm ERR! gyp info it worked if it ends with ok
2021-12-07T12:40:56.892Z [err] npm ERR! gyp info using node-gyp@8.3.0
2021-12-07T12:40:56.892Z [err] npm ERR! gyp info using node@16.13.1 | linux | arm
2021-12-07T12:40:56.892Z [err] npm
2021-12-07T12:40:56.892Z [err]  ERR! gyp info ok 
2021-12-07T12:40:56.892Z [err] npm ERR! gyp info it worked if it ends with ok
2021-12-07T12:40:56.892Z [err] npm ERR! gyp info using node-gyp@8.3.0
2021-12-07T12:40:56.892Z [err] npm ERR!
2021-12-07T12:40:56.893Z [err]  gyp info using node@16.13.1 | linux | arm
2021-12-07T12:40:56.893Z [err] npm ERR! gyp info find Python using Python version 3.9.7 found at "/usr/bin/python3"
2021-12-07T12:40:56.893Z [err] npm ERR! gyp info spawn /usr/bin/python3
2021-12-07T12:40:56.893Z [err] npm ERR! gyp info spawn args [
2021-12-07T12:40:56.893Z [err] npm ERR!
2021-12-07T12:40:56.893Z [err]  gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
2021-12-07T12:40:56.893Z [err] npm ERR! gyp info spawn args   'binding.gyp',
2021-12-07T12:40:56.893Z [err] npm ERR! gyp info spawn args   '-f',
2021-12-07T12:40:56.893Z [err] npm ERR! gyp info spawn args   'make',
2021-12-07T12:40:56.893Z [err] npm ERR!
2021-12-07T12:40:56.894Z [err]  gyp info spawn args   '-I',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '/config/node-red/node_modules/sqlite3/build/config.gypi',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '-I',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '-I',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '/root/.cache/node-gyp/16.13.1/include/node/common.gypi',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
2021-12-07T12:40:56.894Z [err] npm ERR!
2021-12-07T12:40:56.894Z [err]  gyp info spawn args   '-Dvisibility=default',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/16.13.1',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
2021-12-07T12:40:56.894Z [err] npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.13.1/<(target_arch)/node.lib',
2021-12-07T12:40:56.894Z [err] npm 
2021-12-07T12:40:56.895Z [err] ERR! gyp info spawn args   '-Dmodule_root_dir=/config/node-red/node_modules/sqlite3',
2021-12-07T12:40:56.895Z [err] npm ERR! gyp info spawn args   '-Dnode_engine=v8',
2021-12-07T12:40:56.895Z [err] npm ERR! gyp info spawn args   '--depth=.',
2021-12-07T12:40:56.895Z [err] npm 
2021-12-07T12:40:56.895Z [err] ERR! gyp info spawn args   '--no-parallel',
2021-12-07T12:40:56.895Z [err] npm 
2021-12-07T12:40:56.895Z [err] ERR! gyp info spawn args   '--generator-output',
2021-12-07T12:40:56.895Z [err] npm
2021-12-07T12:40:56.896Z [err]  ERR! gyp info spawn args   'build',
2021-12-07T12:40:56.896Z [err] npm ERR! gyp info spawn args   '-Goutput_dir=.'
2021-12-07T12:40:56.896Z [err] npm ERR!
2021-12-07T12:40:56.896Z [err]  gyp info spawn args ]
2021-12-07T12:40:56.896Z [err] npm ERR! gyp info ok 
2021-12-07T12:40:56.896Z [err] npm ERR! gyp info it worked if it ends with ok
2021-12-07T12:40:56.896Z [err] npm ERR! gyp info using node-gyp@8.3.0
2021-12-07T12:40:56.896Z [err] npm ERR! gyp info using node@16.13.1 | linux | arm
2021-12-07T12:40:56.896Z [err] npm
2021-12-07T12:40:56.897Z [err]  ERR! gyp ERR! build error 
2021-12-07T12:40:56.897Z [err] npm ERR! gyp ERR! stack Error: not found: make
2021-12-07T12:40:56.897Z [err] npm
2021-12-07T12:40:56.897Z [err]  ERR! gyp ERR! stack     at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:10:17)
2021-12-07T12:40:56.897Z [err] npm ERR! gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/which.js:57:18
2021-12-07T12:40:56.897Z [err] npm ERR! gyp ERR! stack     at new Promise (<anonymous>)
2021-12-07T12:40:56.897Z [err] npm ERR! gyp ERR! stack     at step (/usr/lib/node_modules/npm/node_modules/which/which.js:54:21)
2021-12-07T12:40:56.897Z [err] npm ERR! gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/which.js:71:22
2021-12-07T12:40:56.897Z [err] npm
2021-12-07T12:40:56.898Z [err]  ERR! gyp ERR! stack     at new Promise (<anonymous>)
2021-12-07T12:40:56.898Z [err] npm ERR! gyp ERR! stack     at subStep (/usr/lib/node_modules/npm/node_modules/which/which.js:69:33)
2021-12-07T12:40:56.898Z [err] npm
2021-12-07T12:40:56.898Z [err]  ERR! gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/which.js:80:22
2021-12-07T12:40:56.898Z [err] npm ERR! gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/isexe/index.js:42:5
2021-12-07T12:40:56.898Z [err] npm 
2021-12-07T12:40:56.898Z [err] ERR! gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
2021-12-07T12:40:56.898Z [err] npm ERR! gyp ERR! System Linux 5.10.17-v7l
2021-12-07T12:40:56.898Z [err] npm ERR!
2021-12-07T12:40:56.898Z [err]  gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/config/node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/config/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"
2021-12-07T12:40:56.898Z [err] npm ERR! gyp ERR! cwd /config/node-red/node_modules/sqlite3
2021-12-07T12:40:56.898Z [err] npm ERR!
2021-12-07T12:40:56.899Z [err]  gyp ERR! node -v v16.13.1
2021-12-07T12:40:56.899Z [err] npm ERR! gyp ERR! node-gyp -v v8.3.0
2021-12-07T12:40:56.899Z [err] npm ERR!
2021-12-07T12:40:56.899Z [err]  gyp ERR! not ok 
2021-12-07T12:40:56.899Z [err] npm ERR! node-pre-gyp ERR! build error 
2021-12-07T12:40:56.899Z [err] npm ERR!
2021-12-07T12:40:56.899Z [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 build --fallback-to-build --module=/config/node-red/node_modules/sqlite3/lib/binding/napi-v3-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/config/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)
2021-12-07T12:40:56.899Z [err] npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/config/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
2021-12-07T12:40:56.899Z [err] npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
2021-12-07T12:40:56.899Z [err] npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
2021-12-07T12:40:56.899Z [err] npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
2021-12-07T12:40:56.899Z [err] npm
2021-12-07T12:40:56.900Z [err]  ERR! node-pre-gyp ERR! System Linux 5.10.17-v7l
2021-12-07T12:40:56.900Z [err] npm ERR! node-pre-gyp ERR! command "/usr/bin/node" "/config/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
2021-12-07T12:40:56.900Z [err] npm
2021-12-07T12:40:56.900Z [err]  ERR! node-pre-gyp ERR! cwd /config/node-red/node_modules/sqlite3
2021-12-07T12:40:56.900Z [err] npm ERR! node-pre-gyp ERR! node -v v16.13.1
2021-12-07T12:40:56.900Z [err] npm 
2021-12-07T12:40:56.900Z [err] ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
2021-12-07T12:40:56.900Z [err] npm ERR! node-pre-gyp ERR! not ok
2021-12-07T12:40:56.964Z [err] 
2021-12-07T12:40:56.965Z [err] npm ERR! A complete log of this run can be found in:
2021-12-07T12:40:56.965Z [err] npm ERR!     /root/.npm/_logs/2021-12-07T12_40_56_906Z-debug.log
2021-12-07T12:40:56.999Z rc=1

pi4 node-red env info

 Add-on version: 10.2.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 6.6  (armv7 / raspberrypi4)
 Home Assistant Core: 2021.10.7
 Home Assistant Supervisor: 2021.10.8
-----------------------------------------------------------
7 Dec 17:34:40 - [info] Node-RED version: v2.1.4
7 Dec 17:34:40 - [info] Node.js  version: v16.13.1
7 Dec 17:34:40 - [info] Linux 5.10.17-v7l arm LE
7 Dec 17:34:41 - [info] Loading palette nodes
7 Dec 17:34:47 - [info] Dashboard version 3.1.2 started at /endpoint/ui
7 Dec 17:34:47 - [warn] ------------------------------------------------------
7 Dec 17:34:47 - [warn] [node-red-node-rbe/rbe] 'rbe' already registered by module node-red
7 Dec 17:34:47 - [warn] ------------------------------------------------------
7 Dec 17:34:47 - [info] Settings file  : /etc/node-red/config.js
7 Dec 17:34:47 - [info] Context store  : 'default' [module=memory]
7 Dec 17:34:47 - [info] User directory : /config/node-red/
7 Dec 17:34:47 - [warn] Projects disabled : editorTheme.projects.enabled=false
7 Dec 17:34:47 - [info] Flows file     : /config/node-red/flows.json
7 Dec 17:34:48 - [info] Server now running at http://127.0.0.1:46836/

node-red env info on working vm ware

Add-on version: 10.2.0
You are running the latest version of this add-on.
System: Home Assistant OS 6.6  (amd64 / qemux86-64)
Home Assistant Core: 2021.11.5
Home Assistant Supervisor: 2021.10.8
-----------------------------------------------------------
7 Dec 18:11:52 - [info] Node-RED version: v2.1.4
7 Dec 18:11:52 - [info] Node.js  version: v16.13.1
7 Dec 18:11:52 - [info] Linux 5.10.75 x64 LE
7 Dec 18:11:53 - [info] Loading palette nodes
7 Dec 18:11:58 - [info] Dashboard version 3.1.2 started at /endpoint/ui
7 Dec 18:12:00 - [info] Settings file  : /etc/node-red/config.js
7 Dec 18:12:00 - [info] Context store  : 'default' [module=memory]
7 Dec 18:12:00 - [info] User directory : /config/node-red/
7 Dec 18:12:00 - [info] Flows file     : /config/node-red/flows.json
7 Dec 18:12:00 - [info] Server now running at http://127.0.0.1:46836/

Hello Pane,

I see you are on Node.js version: v16.13.1
i dont think the sqlite node supports this version yet
only because the underlying sqlite3 library doesnt support it

image

Can you try to downgrade, if possible, to Nodejs version 14 ?
Since you are on raspberry pi4 you can use the official Node-red install script with --node14 appended at the end to downgrade

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node14

ps. im not exactly sure if this is the correct procedure for home assistant though !!

Thank you for your reply UnborN,
I'll try soon to install it with nodejs14 on a raspeberry with raspbian then, since I don't think will be easy for me or possible to downgrade it into the home assistant add on.

But still, how can it work on virtual machine? Even into the vm I'm running same home assistant os, node-red and nodejs versions...

I don't think it is that. The node installs ok for me with nodejs 16.13.1 on Ubuntu.
I am not sure if I have v16 on a pi....

[Edit] No, I don't have a pi with v16.

@Pane19 it would be interesting to first run the install script with --node16 and then see if sqlite installs, as it may be an issue with HA. If it still doesn't then re-run the script with 14 and try again.

Thank you Colin
I've just flashed raspbian on a spare pi zero and then tried with nodejs16, it built and installed sqlite. It took forever but is working fine there.

I guess is the add on for home assistant, maybe something was removed to save disk space... But I have no idea where to look based on the log.

You need to
sudo apt install build-essential

Mmmh that could be a problem, I can't enter the terminal of the node-red add on in HA.
Is there an npm package that can substitute that?

I think you need to ask on an HA forum about the problem.

If you really want to use HA that is. Most here prefer not to use it.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.