Can't update NodeRed on Pi3

Hi, I'm using the bash recomended:
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
But it says I've the nodejs version 10 and won't proceed. I've removed npm and nodejs and reinstlal it, it keeps installing 10.24.1
What's wring here? Why can't install nodejs 14? How can I update Nodered?

Thanks.
PS: may you please introduce a command like node-red-update instead of bash, thank you a lot!

9 Jul 12:49:46 - [info] Node-RED version: v1.3.4
9 Jul 12:49:46 - [info] Node.js version: v10.24.1
9 Jul 12:49:46 - [info] Linux 4.19.66-v7+ arm LE
9 Jul 12:49:47 - [info] Loading palette nodes

RESULT/SOLUTION:
lot of confusion and combination of misbehaves, I was running an old Distro of Raspbian, even if I updated it I was still on 2019, I needed to change sources.list to get the new one. The Node red update script refused to upldate node.js from 10 to 14, probably because of distro, but I forced and it was ok. I've start then having problem with one hided module, ncd-comm, that I guess was part of NR core but not.. it was from an old module that is not more compatible with Node.js 14 (here started problems) but sounds similar to ncd-red-comm which was working and part of core. To solve it it was just necessary to remove the node from flow (edit text mode) and maybe remove from NR with npn uninstall.
Anyway I've updated the Distro cause Python went old too, then I removed NR, pured out package.json from unused modules, deleted packages.lock, installed NR with script and probably that enough to reinstall all modules in package.json. If not you need run npm install.
Do not use NVM to manage nodes.js, it brings lot of problems on compiling. That's the summary of 11h of crazy time :frowning: Thans to all who supported me <3

Try adding --node14

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

thank you for answer, sincerely I'm a bit worried to force install node v14 if automatically it doesn't. Why it keeps installing version 10?

Don't worry. Node 14 is LTS. V10 is out of support and will not get critical updates.

I did it, but probably I didn't have to, now I've problems with I2C


> node-gyp rebuild

make: Entering directory '/home/pi/node_modules/i2c-bus/build'
  CXX(target) Release/obj.target/i2c/src/i2c.o
In file included from ../../nan/nan_converters.h:67:0,
                 from ../../nan/nan.h:202,
                 from ../src/i2c.cc:2:
../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ToFactoryBase<v8::Boolean>::return_t Nan::imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value>)’:
../../nan/nan_converters_43_inl.h:18:69: error: no matching function for call to ‘v8::Value::ToBoolean(v8::Local<v8::Context>)’
       val->To ## TYPE(v8::Isolate::GetCurrent()->GetCurrentContext())          \
                                                                     ^
../../nan/nan_converters_43_inl.h:22:1: note: in expansion of macro ‘X’
 X(Boolean)
 ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2848:18: note: candidate: v8::Local<v8::Boolean> v8::Value::ToBoolean(v8::Isolate*) const
   Local<Boolean> ToBoolean(Isolate* isolate) const;
                  ^~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2848:18: note:   no known conversion for argument 1 from ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’
In file included from ../../nan/nan_converters.h:67:0,
                 from ../../nan/nan.h:202,
                 from ../src/i2c.cc:2:
../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ValueFactoryBase<bool>::return_t Nan::imp::ToFactory<bool>::convert(v8::Local<v8::Value>)’:
../../nan/nan_converters_43_inl.h:37:57: error: no matching function for call to ‘v8::Value::BooleanValue(v8::Local<v8::Context>)’
   return val->NAME ## Value(isolate->GetCurrentContext());                     \
                                                         ^
../../nan/nan_converters_43_inl.h:40:1: note: in expansion of macro ‘X’
 X(bool, Boolean)
 ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2858:8: note: candidate: bool v8::Value::BooleanValue(v8::Isolate*) const
   bool BooleanValue(Isolate* isolate) const;
        ^~~~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2858:8: note:   no known conversion for argument 1 from ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’
In file included from ../../nan/nan_new.h:189:0,
                 from ../../nan/nan.h:203,
                 from ../src/i2c.cc:2:
../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::Function>::return_t Nan::imp::Factory<v8::Function>::New(Nan::FunctionCallback, v8::Local<v8::Value>)’:
../../nan/nan_implementation_12_inl.h:105:32: error: no matching function for call to ‘v8::Function::New(v8::Isolate*&, void (&)(const v8::FunctionCallbackInfo<v8::Value>&), v8::Local<v8::Object>&)’
                           , obj));
                                ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:4445:31: note: candidate: static v8::MaybeLocal<v8::Function> v8::Function::New(v8::Local<v8::Context>, v8::FunctionCallback, v8::Local<v8::Value>, int, v8::ConstructorBehavior, v8::SideEffectType)
   static MaybeLocal<Function> New(
                               ^~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:4445:31: note:   no known conversion for argument 1 from ‘v8::Isolate*’ to ‘v8::Local<v8::Context>’
In file included from ../../nan/nan_new.h:189:0,
                 from ../../nan/nan.h:203,
                 from ../src/i2c.cc:2:
../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)’:
../../nan/nan_implementation_12_inl.h:337:37: error: no matching function for call to ‘v8::StringObject::New(v8::Local<v8::String>&)’
   return v8::StringObject::New(value).As<v8::StringObject>();

         MANY OTHER LOGS HERE.. 

In file included from ../src/i2c.cc:106:0:
../src/./writei2cblock.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE WriteI2cBlockSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/./writei2cblock.cc:108:32: error: no matching function for call to ‘v8::Value::Int32Value()’
   int fd = info[0]->Int32Value();
                                ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note:   candidate expects 1 argument, 0 provided
In file included from ../src/i2c.cc:106:0:
../src/./writei2cblock.cc:109:34: error: no matching function for call to ‘v8::Value::Int32Value()’
   __u8 cmd = info[1]->Int32Value();
                                  ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note:   candidate expects 1 argument, 0 provided
In file included from ../src/i2c.cc:106:0:
../src/./writei2cblock.cc:110:39: error: no matching function for call to ‘v8::Value::Uint32Value()’
   __u32 length = info[2]->Uint32Value();
                                       ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2866:41: note: candidate: v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
                                         ^~~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
In file included from ../src/i2c.cc:107:0:
../src/./writequick.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE WriteQuickAsync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/./writequick.cc:47:32: error: no matching function for call to ‘v8::Value::Int32Value()’
   int fd = info[0]->Int32Value();
                                ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note:   candidate expects 1 argument, 0 provided
In file included from ../src/i2c.cc:107:0:
../src/./writequick.cc:48:34: error: no matching function for call to ‘v8::Value::Int32Value()’
   __u8 bit = info[1]->Int32Value();
                                  ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note:   candidate expects 1 argument, 0 provided
In file included from ../src/i2c.cc:107:0:
../src/./writequick.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE WriteQuickSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/./writequick.cc:60:32: error: no matching function for call to ‘v8::Value::Int32Value()’
   int fd = info[0]->Int32Value();
                                ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note:   candidate expects 1 argument, 0 provided
In file included from ../src/i2c.cc:107:0:
../src/./writequick.cc:61:34: error: no matching function for call to ‘v8::Value::Int32Value()’
   __u8 bit = info[1]->Int32Value();
                                  ^
In file included from /home/pi/.cache/node-gyp/14.17.2/include/node/node.h:67:0,
                 from ../src/i2c.cc:1:
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/pi/.cache/node-gyp/14.17.2/include/node/v8.h:2869:40: note:   candidate expects 1 argument, 0 provided
i2c.target.mk:111: recipe for target 'Release/obj.target/i2c/src/i2c.o' failed
make: *** [Release/obj.target/i2c/src/i2c.o] Error 1
make: Leaving directory '/home/pi/node_modules/i2c-bus/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:375:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
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" "rebuild"
gyp ERR! cwd /home/pi/node_modules/i2c-bus
gyp ERR! node -v v14.17.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! i2c-bus@1.2.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the i2c-bus@1.2.5 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-07-09T10_16_46_579Z-debug.log

Flows stopped due to missing node types.
ncd-comm

Now I cannot use more Node red, should I reverse back to node 10.24? How can I do it safely?

do you know which node is using i2c ?

Too late now but the script should have also said you could " update to the latest Node-RED 1.x version by adding --nodered-version="1.3.5" to the install command." which leaves nodejs alone.

Thak you for supporting, I really appreciate this :slight_smile:
Yes I send the pic
immagine
immagine
and I use LCD 4x20 and ADS1115
there is also another error here:
immagine

The first seems to use "i2c-bus": "^5.1.0" - so should be updateable
likewise serialport...
so go into your .node-red directory and run npm outdated and show us the list

you should then be able to run npm update && npm rebuild

I'm doing it, for now:
pi@RaspbFranco:~ $ npm outdated
Package Current Wanted Latest Location
node-red-contrib-i2c 0.5.2 0.5.2 0.8.3 global
npm 6.5.0 6.14.13 7.19.1 global

is that in your ~/.node-red directory ?

in the directory returns nothing:
pi@RaspbFranco:~/.node-red $ npm outdated
pi@RaspbFranco:~/.node-red $

then I've done update as you told me and here is the result:

Still can't run flows:

pi@RaspbFranco:~/.node-red $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.251:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
9 Jul 14:17:05 - [info]
Welcome to Node-RED
===================
9 Jul 14:17:05 - [info] Node-RED version: v1.3.5
9 Jul 14:17:05 - [info] Node.js  version: v14.17.2
9 Jul 14:17:05 - [info] Linux 4.19.66-v7+ arm LE
9 Jul 14:17:06 - [info] Loading palette nodes
Initializing HAP-NodeJS v0.9.4...
9 Jul 14:17:16 - [info] Dashboard version 2.30.0 started at /ui
9 Jul 14:17:17 - [warn] ------------------------------------------------------
9 Jul 14:17:17 - [warn] [ncd-red-comm/ncd-comm] Error: The module '/home/pi/.node-red/node_modules/@serialport/bindings/build/Release/bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 83. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
9 Jul 14:17:17 - [warn] ------------------------------------------------------
9 Jul 14:17:17 - [info] Settings file  : /home/pi/.node-red/settings.js
9 Jul 14:17:17 - [info] Context store  : 'default' [module=memory]
9 Jul 14:17:17 - [info] User directory : /home/pi/.node-red
9 Jul 14:17:17 - [warn] Projects disabled : editorTheme.projects.enabled=false
9 Jul 14:17:17 - [info] Flows file     : /home/pi/.node-red/flows_RaspbFranco.json
9 Jul 14:17:18 - [info] Server now running at http://127.0.0.1:1880/
9 Jul 14:17:18 - [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.
---------------------------------------------------------------------
9 Jul 14:17:18 - [info] Waiting for missing types to be registered:
9 Jul 14:17:18 - [info]  - ncd-comm

Still have: Package Current Wanted Latest Location
node-red-contrib-i2c 0.5.2 0.5.2 0.8.3 global
npm 6.14.13 6.14.13 7.19.1 global

it doesn't update.. how can I do force update it? maybe on root?
But on palette shows it's updated
immagine

so try npm i node-red-contrib-i2c@latest to force that as well

I did it, still not solving, here is the log. Any chances that the old verion still in onther path? Maybe I've installed it not under the node red folder in past.

pi@RaspbFranco:~ $ npm i node-red-contrib-i2c@latest

> i2c-bus@5.2.2 install /home/pi/node_modules/node-red-contrib-i2c/node_modules/i2c-bus
> node-gyp rebuild

make: Entering directory '/home/pi/node_modules/node-red-contrib-i2c/node_modules/i2c-bus/build'
  CXX(target) Release/obj.target/i2c/src/i2c.o
  SOLINK_MODULE(target) Release/obj.target/i2c.node
  COPY Release/i2c.node
make: Leaving directory '/home/pi/node_modules/node-red-contrib-i2c/node_modules/i2c-bus/build'
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.

+ node-red-contrib-i2c@0.8.3
added 4 packages from 9 contributors, updated 1 package and audited 447 packages in 30.379s

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

found 0 vulnerabilities

pi@RaspbFranco:~ $ cd .node-red
pi@RaspbFranco:~/.node-red $ npm i node-red-contrib-i2c@latest
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

+ node-red-contrib-i2c@0.8.3
updated 1 package and audited 1544 packages in 55.701s

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

found 1016 vulnerabilities (619 low, 55 moderate, 340 high, 2 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

Anyway now I don't have more i2c to update, but can' understand why I still have problem with ncd-comm

pi@RaspbFranco:~ $ npm outdated
Package Current Wanted Latest Location
npm 6.14.13 6.14.13 7.19.1 global

I've rebooted Pi3 too and did't help

What can I do to revive my node red? (

indeed - possibly was/is in wrong path. There should be nothing in your user dir ( ~/ ) if there is a ~/node_modules then we need to remove that... everything should be under ~/.node-red
What user is node-red running as ? i

There was the folder, I've deleted it as you suggested, now nod red stucks on starting, what can I do now? Thaks for help!

pi@RaspbFranco:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.251:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
9 Jul 14:42:26 - [info]  - ncd-comm


I've done again a npm update && npm rebuild under the nodered folder, the same big list of errors and still not load ncd-comm when I start it..
there is any way to rebuild completely everything? Now I've deleted the modules in the wrong folder, how can I download them agin into the right one? Thank you

I try to fix myself but I can't find any info in google about rebuild everything. I hope somebody can help me, thank you