Node-Red 1.3.1 and sqlite3 again

Up to NR 1.2.9 I had everything installing and updating perfectly.... but here we go again - the Pi NR upgrade script - upgraded to NR 1.3.1 - the update reported issues with the serial port, i2c and sqlite3. I reinstalled serial and that seemed to work - I was not using i2c and so simply removed it from NR settings.js but nothing would bring back SQLITE3... not even removing the folder from /home/pi/.node-red/node_modules and reinstalling (which failed at the sqlite3@4.1.1 install script). Ultimately I took the plunge and eliminated SQLITE3 but there has to be a better way? The end of this blog entry has the results and that blog entry details my long, sordid experience with SQLITE3 on Node-Red.. SQLITE3 Raspberry Pi Problems and Solutions? - Scargill's Tech Blog

What version of nodejs are you using?
And what version of raspbian?
Did you sudo apt update && sudo apt full-upgrade?

this is very head scratchy - I just let the node-red-node-sqlite drag in the sqlite3 code and it just seems to update for me. yes it takes a while to compile but it always seems to pop out the other end ok. This is on a Pi3 with node12 and (now) NR 1.3.1.

If I do do a rebuild I just do it for the whole of the .node-red directory - I don't try and specify a particular node. If you really want to force it you can add flags --update-binary to reinstall or --build-from-source to recompile. (and then wait even longer :-)... but I've never had to.

2 Likes

Just for fun I ran (from within ~/.node-red dir) npm rebuild --update-binary --build-from-source sqlite3
and eventually ended up with

...
  SOLINK_MODULE(target) Release/obj.target/node_sqlite3.node
  COPY Release/node_sqlite3.node
  COPY /home/pi/.node-red/node_modules/sqlite3/lib/binding/node-v83-linux-arm/node_sqlite3.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/home/pi/.node-red/node_modules/sqlite3/build'
sqlite3@4.2.0 /home/pi/.node-red/node_modules/sqlite3

but as I said - I only did this to test - usually I don't need to do that.

Sorry for the delay guys..

Raspbian version 10
Nodejs is 12.22.1 (after the upgrade - and I'e had to remove I2c and sqlite to get this all working)....
I never use full-upgrade - I use sudo apt update then sudo apt upgrade

You should use full-upgrade. If you don't you may not get everything upgraded to the latest versions. It does not try to upgrade you to the next distribution version if that is what you are thinking. apt upgrade will never remove packages, full-upgrade will remove packages if it is necessary to do that in order to upgrade other packages, as is sometimes the case.

Hi - last couple of time I've upgraded NR all has been fine - but this time I had the problem with serial, i2c and sqlite3 - I got back in working order by removing i2c reference in settings.js but I had to stop using SQLITE3 to get this upgrade to work - after several attempts to upgrade SQLITE3.. using the 4-liner here..

(for clarity I'm using RPi4)

node-red-stop
cd /home/pi/.node-red
npm rebuild sqlite3
node-red-start

which simply would not do it this time.

Ok, so taking Colin's lead...

I've just gone back to my clone of NR 1.2.9 - and this time I've done "sudo apt update - sudo apt full-upgrade" first...

" Newer kernel available │
The currently running kernel version is 5.10.17-v7l+ which is not the expected kernel version 5.10.17-v8+.
Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting. "

I rebooted then "node-red-start"

All worked - NR 1.2.9

I then used this script to update NR as usual but this time the script did not seem to upgrade node.js... leaving v10.24.1 in place apparently ... I've no idea why..

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

I don't BELIEVE THIS. Eveything works and I'm on NR 1.3.1 - nodejs 10.24.1 - the only change was using full-upgrade instead of upgrade. No rebuilding of sqlite, no i2c problems - no serial problems.

BUT as I said before it has NOT updated node.js
Leave existing Node.js - Node v10.24.1 Npm 6.14.12

Well.....

The script should not upgrade nodejs from 10 to 12. Have you still go the install log from that one?

Hi Colin

I've been doing this a long time but you have managed to surprise me - I had NO idea that full-upgrade was recommendd - out there generally for RPI updates you usually see apt-update and apt-upgrade. I stand corrected.

I only thought it should update NodeJS because of the name of the script and maybe something Dave said..

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

Ok, so next time I need to upgrade node-red I'll do that full-upgrade first - this was certsainly successful - though of course it is nodejs upgrades that actually result in the issues with sqlite etc... however, all in all - a success and thanks for the feedback. I only have the log for the sorking upgrade because after much testing I turned the original SD into a clone (rpi-clone is one of the main reasons I stick with RPI these days). I'm on SSD generally.

So- thanks.

Yes, last log..


***************************************

Started : Sat 10 Apr 22:54:12 CEST 2021
Running for user pi at /home/pi
Found global nodes:   :

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodered' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  libc-ares2 nodejs-doc
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Already have nodejs v10.24.1
Now install nodejs
Versions: node:v10.24.1 npm:6.14.12
Now install Node-RED
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/usr/bin/node-red -> /usr/lib/node_modules/node-red/red.js
/usr/bin/node-red-pi -> /usr/lib/node_modules/node-red/bin/node-red-pi

> bcrypt@3.0.6 install /usr/lib/node_modules/node-red/node_modules/bcrypt
> 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(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v64-linux-arm-glibc.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@10.24.1 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
make: Entering directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
In file included from ../src/bcrypt_node.cc:1:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../../nan/nan.h:53,
                 from ../src/bcrypt_node.cc:1:
../src/bcrypt_node.cc: At global scope:
/root/.cache/node-gyp/10.24.1/include/node/node.h:573:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/root/.cache/node-gyp/10.24.1/include/node/node.h:607:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/bcrypt_node.cc:378:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(bcrypt_lib, init);
 ^~~~~~~~~~~
In file included from /root/.cache/node-gyp/10.24.1/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/bcrypt_node.cc:1:
/root/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/root/.cache/node-gyp/10.24.1/include/node/node_object_wrap.h:84:78:   required from here
/root/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/root/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
  COPY Release/bcrypt_lib.node
  COPY /usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'

> bcrypt@3.0.8 install /usr/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt
> 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(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.8/bcrypt_lib-v3.0.8-node-v64-linux-arm-glibc.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.8 and node@10.24.1 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) 
make: Entering directory '/usr/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
In file included from ../src/bcrypt_node.cc:1:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2298:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../../nan/nan.h:54,
                 from ../src/bcrypt_node.cc:1:
../src/bcrypt_node.cc: At global scope:
/root/.cache/node-gyp/10.24.1/include/node/node.h:573:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/root/.cache/node-gyp/10.24.1/include/node/node.h:607:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/bcrypt_node.cc:359:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(bcrypt_lib, init);
 ^~~~~~~~~~~
In file included from /root/.cache/node-gyp/10.24.1/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/bcrypt_node.cc:1:
/root/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/root/.cache/node-gyp/10.24.1/include/node/node_object_wrap.h:84:78:   required from here
/root/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/root/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
  COPY Release/bcrypt_lib.node
  COPY /usr/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/usr/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/build'
+ node-red@1.3.1
added 350 packages from 316 contributors in 223.16s
1.3.1 
Now create basic package.json for the user and move any global nodes
Installing extra nodes: node-red-node-pi-gpio@latest node-red-node-random@latest node-red-node-ping@latest node-red-contrib-play-audio@latest node-red-node-smooth@latest node-red-node-serialport@latest :

> @serialport/bindings@9.0.7 install /home/pi/.node-red/node_modules/node-red-node-serialport/node_modules/@serialport/bindings
> prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=10.24.1 runtime=node arch=arm libc= platform=linux)
make: Entering directory '/home/pi/.node-red/node_modules/node-red-node-serialport/node_modules/@serialport/bindings/build'
  CXX(target) Release/obj.target/bindings/src/serialport.o
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Open(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:78:69: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Open, (uv_after_work_cb)EIO_AfterOpen);
                                                                     ^~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Update(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:135:71: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Update, (uv_after_work_cb)EIO_AfterUpdate);
                                                                       ^~~~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Close(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:175:70: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Close, (uv_after_work_cb)EIO_AfterClose);
                                                                      ^~~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Flush(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:215:70: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Flush, (uv_after_work_cb)EIO_AfterFlush);
                                                                      ^~~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Set(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:271:68: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Set, (uv_after_work_cb)EIO_AfterSet);
                                                                    ^~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Get(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:316:68: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Get, (uv_after_work_cb)EIO_AfterGet);
                                                                    ^~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE GetBaudRate(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:366:76: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_GetBaudRate, (uv_after_work_cb)EIO_AfterGetBaudRate);
                                                                            ^~~~~~~~~~~~~~~~~~~~
../src/serialport.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE Drain(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/serialport.cpp:412:70: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
   uv_queue_work(uv_default_loop(), req, EIO_Drain, (uv_after_work_cb)EIO_AfterDrain);
                                                                      ^~~~~~~~~~~~~~
../src/serialport.cpp: At global scope:
../src/serialport.cpp:433:28: warning: unnecessary parentheses in declaration of ‘ToParityEnum’ [-Wparentheses]
 SerialPortParity NAN_INLINE(ToParityEnum(const v8::Local<v8::String>& v8str)) {
                            ^
../src/serialport.cpp:452:30: warning: unnecessary parentheses in declaration of ‘ToStopBitEnum’ [-Wparentheses]
 SerialPortStopBits NAN_INLINE(ToStopBitEnum(double stopBits)) {
                              ^
In file included from ../../../nan/nan.h:56,
                 from ../src/./serialport.h:6,
                 from ../src/serialport.cpp:1:
/home/pi/.cache/node-gyp/10.24.1/include/node/node.h:573:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/pi/.cache/node-gyp/10.24.1/include/node/node.h:607:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/serialport.cpp:486:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(serialport, init);
 ^~~~~~~~~~~
In file included from /home/pi/.cache/node-gyp/10.24.1/include/node/node.h:63,
                 from ../../../nan/nan.h:56,
                 from ../src/./serialport.h:6,
                 from ../src/serialport.cpp:1:
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/pi/.cache/node-gyp/10.24.1/include/node/node_object_wrap.h:84:78:   required from here
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../../nan/nan_object_wrap.h:65:61:   required from here
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  CXX(target) Release/obj.target/bindings/src/serialport_unix.o
In file included from /home/pi/.cache/node-gyp/10.24.1/include/node/node.h:63,
                 from ../../../nan/nan.h:56,
                 from ../src/serialport.h:6,
                 from ../src/serialport_unix.cpp:2:
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/pi/.cache/node-gyp/10.24.1/include/node/node_object_wrap.h:84:78:   required from here
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../../nan/nan_object_wrap.h:65:61:   required from here
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
../src/serialport_unix.cpp: In function ‘int setup(int, OpenBaton*)’:
../src/serialport_unix.cpp:176:60: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1005 [-Wformat-truncation=]
     snprintf(data->errorString, sizeof(data->errorString), "Error %s Cannot open %s", strerror(errno), data->path);
                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~
../src/serialport_unix.cpp:176:13: note: ‘snprintf’ output 20 or more bytes (assuming 1043) into a destination of size 1024
     snprintf(data->errorString, sizeof(data->errorString), "Error %s Cannot open %s", strerror(errno), data->path);
     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/serialport_unix.cpp: In function ‘void EIO_Open(uv_work_t*)’:
../src/serialport_unix.cpp:86:60: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1003 [-Wformat-truncation=]
     snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot open %s", strerror(errno), data->path);
                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/serialport_unix.cpp:86:13: note: ‘snprintf’ output 22 or more bytes (assuming 1045) into a destination of size 1024
     snprintf(data->errorString, sizeof(data->errorString), "Error: %s, cannot open %s", strerror(errno), data->path);
     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CXX(target) Release/obj.target/bindings/src/poller.o
In file included from /home/pi/.cache/node-gyp/10.24.1/include/node/node.h:63,
                 from ../../../nan/nan.h:56,
                 from ../src/poller.cpp:1:
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/pi/.cache/node-gyp/10.24.1/include/node/node_object_wrap.h:84:78:   required from here
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../../nan/nan_object_wrap.h:65:61:   required from here
/home/pi/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  CXX(target) Release/obj.target/bindings/src/serialport_linux.o
  SOLINK_MODULE(target) Release/obj.target/bindings.node
  COPY Release/bindings.node
make: Leaving directory '/home/pi/.node-red/node_modules/node-red-node-serialport/node_modules/@serialport/bindings/build'
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

+ node-red-node-smooth@0.1.2
+ node-red-node-random@0.4.0
+ node-red-node-pi-gpio@1.2.3
+ node-red-contrib-play-audio@2.5.0
+ node-red-node-ping@0.3.1
+ node-red-node-serialport@0.13.0
added 1 package from 1 contributor, updated 19 packages and moved 1 package in 60.758s
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for pi
ln: failed to create symbolic link '/usr/bin/python': File exists
Now add launcher to top bar, add cpu temp example, make sure ping works
The user `pi' is already a member of `gpio'.
Memory : 2.0G
Finished : Sat 10 Apr 22:54:12 CEST 2021

It will upgrade if it thinks the version you have is not good enough, but not otherwise. So we how it got to nodejs 14 may remain one of the great unsolved mysteries of life.

I am not convinced of that, it may have been the full-upgrade which upgraded some library or build tool or something which fixed it, not the fact that you are back on nodejs 10. It would be interesting, if you had the inclination, and after making a new image backup if you haven't already done that, to upgrade nodejs again and see what happens. If you uninstall nodejs and run the script it should do that.
sudo apt uninstall nodejs.
If it again has problems with rebuilding the serial and sqlite nodes then, in the .node-red folder delete the node_modules folder and package-lock.json and run
npm install
to make sure it has the latest valid versions of everything that your package.json allows. If you had a spare SD card you do this on that card so we can continue investigating without keeping your system offline while we work it out. It would be good to get to the bottom of it.

Hold on though, I am a bit confused, the log you posted shows it failing with nodejs 10.

I absolutely will, once I have a couple of backups and she stops nagging me to work in the garden - I have spare cards.... though not as many as I used to as I've now gone over the 16GB I always used to stay within.

I will follow this up and reply - and thank you.

Hi Colin - so I made 2 SD backups.

First issue - there is no uninstall for jodejs - "remove" works. Done. Now running the script.. :slight_smile:
image

Not sure what that V0 was all about....
installing NR 1.3.1 - I thought I already had that....

So, first run on NR, I2c is missing. Stopped.
So I figured I'd rmove I2c settings from settings.js (I don't use it) and reboot before trying NR again.
Erm, no. sqlite missing again...

So, I'm busy uninstalling the node_modules folder - that's going to take weeks :slight_smile:
Well, it took an hour. deleted the package lock file - then ran npm install (in the node-red folder) - it stopped after 5 minutes,,

erm... no.
image

Hi Colin

Right I've restored my working NODEJS10 setup after that failure - any ideas that don;t involve wiping that node-modules folder :slight_smile: ?

So NOW I've deleted nodejs - and used the script to reinstall nodejs which is also reinstalling NR... and I'll try DAVE's suggestion...

npm rebuild --update-binary --build-from-source sqlite3

Erm, no.

and here's the log..

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/bin/node',
1 verbose cli   '/usr/bin/npm',
1 verbose cli   'rebuild',
1 verbose cli   '--update-binary',
1 verbose cli   '--build-from-source',
1 verbose cli   'sqlite3'
1 verbose cli ]
2 info using npm@6.14.12
3 info using node@v12.22.1
4 info readInstalled object
5 verbose rebuild path, id [ '/home/pi/.node-red/node_modules/sqlite3', 'sqlite3@4.1.1' ]
6 silly rebuild set [ '/home/pi/.node-red/node_modules/sqlite3' ]
7 info build /home/pi/.node-red/node_modules/sqlite3
8 info lifecycle sqlite3@4.1.1~preinstall: sqlite3@4.1.1
9 info linkStuff sqlite3@4.1.1
10 silly linkStuff sqlite3@4.1.1 has /home/pi/.node-red/node_modules as its parent node_modules
11 info lifecycle sqlite3@4.1.1~install: sqlite3@4.1.1
12 verbose lifecycle sqlite3@4.1.1~install: unsafe-perm in lifecycle true
13 verbose lifecycle sqlite3@4.1.1~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/.node-red/node_modules/sqlite3/node_modules/.bin:/home/pi/.node-red/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/pi/.local/bin
14 verbose lifecycle sqlite3@4.1.1~install: CWD: /home/pi/.node-red/node_modules/sqlite3
15 silly lifecycle sqlite3@4.1.1~install: Args: [ '-c', 'node-pre-gyp install --fallback-to-build' ]
16 silly lifecycle sqlite3@4.1.1~install: Returned: code: 1  signal: null
17 info lifecycle sqlite3@4.1.1~install: Failed to exec install script
18 verbose stack Error: sqlite3@4.1.1 install: `node-pre-gyp install --fallback-to-build`
18 verbose stack Exit status 1
18 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
18 verbose stack     at EventEmitter.emit (events.js:314:20)
18 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
18 verbose stack     at ChildProcess.emit (events.js:314:20)
18 verbose stack     at maybeClose (internal/child_process.js:1022:16)
18 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
19 verbose pkgid sqlite3@4.1.1
20 verbose cwd /home/pi/.node-red
21 verbose Linux 5.10.17-v7l+
22 verbose argv "/usr/bin/node" "/usr/bin/npm" "rebuild" "--update-binary" "--build-from-source" "sqlite3"
23 verbose node v12.22.1
24 verbose npm  v6.14.12
25 error code ELIFECYCLE
26 error errno 1
27 error sqlite3@4.1.1 install: `node-pre-gyp install --fallback-to-build`
27 error Exit status 1
28 error Failed at the sqlite3@4.1.1 install script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]

Any other ideas guys? I've gone back to my last working clone.

V0 means nodejs was not installed.
It has to re-install node red because you have a new version of nodejs

The error loading the settings file means you had messed up the edit you made in some way.

It is pulling in an old version of sqlite3. Did you delete the package lock file as suggested?

Can you post your package.json file too please in case there is something wrong there?

[Edit] Actually I think you will have to explicitly install the sqlite node to get it to pull in the latest.

Soon as I get home I will follow this up. Thanks for your patience.

In fact you must have an old version of node-red-node-sqlite installed too as the current version (0.6.0) pulls in at least sqlite3 version 4.2.0. Did you upgrade everything to the latest before embarking on this exercise? I don't know that anyone ever suggested doing that but I think it is a good idea as it gives the best chance that everything will be compatible with the later version of nodejs.

Hi

Yes I did delete the package lock file as suggested and I don;t THINK I messed up settings.js
Right I'm looking at the base I'm using right now - everything works - it is sqlite 0.43 - and "manage palette" says it is up to date.
image
Manage Pallets says that ALL nodes are up to date.. I have node-red 1.3.1... so I'm at a loss as to why the upgrade for node.js kills i2c and sqlite even after following advice from you and Dave... any ideas?

I have backups.

Can you share your package.json? There is something wrong as that is not the latest version.