Can't update NodeRed on Pi3

please stop trying to install ncd-comm !
please tidy the package.json... then remove the package-lock.json file as requested - please just re-run the commands as written

rm package-lock.json and rm -r node_modules/ then npm cache clean --force - and finally npm install

DO NOT install anything else after that... - start Node-RED - then stop - then start again.. and show us that log. We will then try to get serialport and i2c working as a next step.

I've already dis that, and I've posted the result, no help. Ok I'll do it again as you said and post here.
By the time I've googled "npm ERR! path /home/pi/.node-red/node_modules/@serialport/bindings" and I've found a thread, I was reading it an by the time I've tried to install the serialport, it did (66 packages) but nothing improved. I've also again tried to install ncd comm.

This is the actual package.json
{
"name": "node-red-project",
"description": "A Node-RED Project",
"version": "0.0.1",
"dependencies": {
"node-red-contrib-alexa-remote2-v2": "~3.10.5",
"node-red-contrib-binary": "~0.1.3",
"node-red-contrib-bravia": "~1.2.0",
"node-red-contrib-config": "~1.2.1",
"node-red-contrib-denon": "~0.1.5",
"node-red-contrib-email-out": "~0.1.1",
"node-red-contrib-homekit-bridged": "~1.3.5",
"node-red-contrib-mqtt-broker": "~0.2.5",
"node-red-contrib-play-audio": "^2.5.0",
"node-red-contrib-simpletime": "~2.10.0",
"node-red-contrib-smartnora": "~1.0.11",
"node-red-contrib-telegrambot": "~9.5.0",
"node-red-contrib-timerswitch": "~1.3.0",
"node-red-contrib-virtual-smart-home": "~2.11.0",
"node-red-dashboard": "~2.30.0",
"node-red-node-email": "~1.12.2",
"node-red-node-pi-gpio": "^1.2.3",
"node-red-node-ping": "^0.3.1",
"node-red-node-random": "^0.4.0",
"node-red-node-rbe": "~0.5.0",
"node-red-node-smooth": "^0.1.2",
"node-red-node-tail": "~0.3.1"
}
}

Ok that looks good

pi@RaspbFranco:~/.node-red $ rm package-lock.json
rm: cannot remove 'package-lock.json': No such file or directory
pi@RaspbFranco:~/.node-red $ rm -r node_modules/
pi@RaspbFranco:~/.node-red $ npm cache clean --force
npm WARN using --force Recommended protections disabled.
pi@RaspbFranco:~/.node-red $ npm install
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated mailcomposer@2.1.0: This project is unmaintained
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated buildmail@2.0.0: This project is unmaintained
npm WARN deprecated querystring@0.2.1: The
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated mimelib@0.3.1: This project is unmaintained
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated uuid@2.0.3: 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.
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 https://v8.dev/blog/math-random for details.
npm WARN deprecated nodemailer@1.11.0: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated node-red-contrib-mqtt-broker@0.2.5: deprecated
npm WARN deprecated mailparser@0.6.2: Mailparser versions older than v2.3.0 are deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated bson@0.4.23: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
npm WARN deprecated mongodb@2.1.21: Please upgrade to 2.2.19 or higher

added 704 packages, and audited 744 packages in 6m

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

25 vulnerabilities (2 low, 6 moderate, 15 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
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.
9 Jul 23:33:14 - [info]
Welcome to Node-RED
===================
9 Jul 23:33:14 - [info] Node-RED version: v1.3.5
9 Jul 23:33:14 - [info] Node.js  version: v14.17.2
9 Jul 23:33:14 - [info] Linux 5.10.48-v7+ arm LE
9 Jul 23:33:17 - [info] Loading palette nodes
Initializing HAP-NodeJS v0.9.4...
9 Jul 23:33:30 - [info] Dashboard version 2.30.0 started at /ui
9 Jul 23:33:31 - [warn] Missing node modules:
9 Jul 23:33:31 - [warn]  - node-red-contrib-i2c (0.8.3): i2c scan, i2c in, i2c out
9 Jul 23:33:31 - [warn]  - node-red-contrib-lcd20x4-i2c (0.1.1): LCD20x4-I2C
9 Jul 23:33:31 - [info] Removing modules from config
9 Jul 23:33:31 - [info] Settings file  : /home/pi/.node-red/settings.js
9 Jul 23:33:31 - [info] Context store  : 'default' [module=memory]
9 Jul 23:33:31 - [info] User directory : /home/pi/.node-red
9 Jul 23:33:31 - [warn] Projects disabled : editorTheme.projects.enabled=false
9 Jul 23:33:31 - [info] Flows file     : /home/pi/.node-red/flows_RaspbFranco.json
9 Jul 23:33:32 - [info] Server now running at http://127.0.0.1:1880/
9 Jul 23:33:32 - [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 23:33:32 - [info] Waiting for missing types to be registered:
9 Jul 23:33:32 - [info]  - ncd-comm
9 Jul 23:33:32 - [info]  - LCD20x4-I2C
9 Jul 23:33:32 - [info]  - i2c in
9 Jul 23:33:32 - [info]  - i2c out


I did remove manually before the lock file
what next?

I'm reading here:

now stop it and node-red --safe and check the editor runs (but don't hit deploy).
Tnen stop it (ctrl-c) - and then npm i node-red-contrib-i2c@latest

It works (as always worked), no errors on palette

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

Stop Node-RED

Use   node-red-start   to start Node-RED again

pi@RaspbFranco:~/.node-red $ node-red --safe
(node:31800) [DEP0128] DeprecationWarning: Invalid 'main' field in '/usr/lib/node_modules/node-red/node_modules/@node-red/editor-client/package.json' of './lib/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
9 Jul 23:38:21 - [info]

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

9 Jul 23:38:21 - [info] Node-RED version: v1.3.5
9 Jul 23:38:21 - [info] Node.js  version: v16.4.2
9 Jul 23:38:21 - [info] Linux 5.10.48-v7+ arm LE
9 Jul 23:38:23 - [info] Loading palette nodes
Initializing HAP-NodeJS v0.9.4...
9 Jul 23:38:33 - [info] Dashboard version 2.30.0 started at /ui
9 Jul 23:38:34 - [info] Settings file  : /home/pi/.node-red/settings.js
9 Jul 23:38:34 - [info] Context store  : 'default' [module=memory]
9 Jul 23:38:34 - [info] User directory : /home/pi/.node-red
9 Jul 23:38:34 - [warn] Projects disabled : editorTheme.projects.enabled=false
9 Jul 23:38:34 - [info] Flows file     : /home/pi/.node-red/flows_RaspbFranco.json
9 Jul 23:38:35 - [info] Server now running at http://127.0.0.1:1880/
9 Jul 23:38:35 - [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 23:38:36 - [info] Waiting for missing types to be registered:
9 Jul 23:38:36 - [info]  - ncd-comm
9 Jul 23:38:36 - [info]  - LCD20x4-I2C
9 Jul 23:38:36 - [info]  - i2c in
9 Jul 23:38:36 - [info]  - i2c out


is this interesting for me?

hopefully not - It's not complaining about that at the moment...
now try npm i node-red-contrib-i2c@latest and restart again
I would hope that gets rid of the two i2c errors

If that works then try npm i node-red-contrib-lcd20x4-i2c and restart again

It doesn't :frowning:

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

added 5 packages, and audited 749 packages in 2m

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

25 vulnerabilities (2 low, 6 moderate, 15 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
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.
9 Jul 23:47:13 - [info]
Welcome to Node-RED
===================
9 Jul 23:47:13 - [info] Node-RED version: v1.3.5
9 Jul 23:47:13 - [info] Node.js  version: v14.17.2
9 Jul 23:47:13 - [info] Linux 5.10.48-v7+ arm LE
9 Jul 23:47:15 - [info] Loading palette nodes
Initializing HAP-NodeJS v0.9.4...
9 Jul 23:47:24 - [info] Dashboard version 2.30.0 started at /ui
9 Jul 23:47:26 - [warn] ------------------------------------------------------
9 Jul 23:47:26 - [warn] [node-red-contrib-i2c/i2c] Error: The module '/home/pi/.node-red/node_modules/i2c-bus/build/Release/i2c.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 93. 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`). (line:3)
9 Jul 23:47:26 - [warn] ------------------------------------------------------
9 Jul 23:47:26 - [info] Settings file  : /home/pi/.node-red/settings.js
9 Jul 23:47:26 - [info] Context store  : 'default' [module=memory]
9 Jul 23:47:26 - [info] User directory : /home/pi/.node-red
9 Jul 23:47:26 - [warn] Projects disabled : editorTheme.projects.enabled=false
9 Jul 23:47:26 - [info] Flows file     : /home/pi/.node-red/flows_RaspbFranco.json
9 Jul 23:47:26 - [info] Server now running at http://127.0.0.1:1880/
9 Jul 23:47:26 - [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 23:47:27 - [info] Waiting for missing types to be registered:
9 Jul 23:47:27 - [info]  - ncd-comm
9 Jul 23:47:27 - [info]  - LCD20x4-I2C
9 Jul 23:47:27 - [info]  - i2c in
9 Jul 23:47:27 - [info]  - i2c out


I suppose that since ncd comm is not installed i2c doesn't work also.
There is maybe an uncompatibility with nodejs 14 and serialport?

If Yes I guess I shpould remove nodejs (how?) install manually 10.24 and rebuild node red

no - I have i2c installed with node14... but it says it as compiled against NODE_MODULE_VERSION 93. - which corresponds to node16.... are you running nvm or n or some other shell ?

no I have one shell only, if you think it's better I reboot. I haven't reboot since I' upgraded with nvm

ah you said nvm ! - we need to get rid of that .... that is the cause of most of this aggro

Trying myself to fix (uninstall and reinstall nodejs) I've read that nvm is the best solution, and I've installed it. What can I do?


pi@RaspbFranco:~/.node-red $ node -v
v16.4.2
pi@RaspbFranco:~/.node-red $ mpm -v
-bash: mpm: command not found
pi@RaspbFranco:~/.node-red $ npm -v
7.18.1
pi@RaspbFranco:~/.node-red $ python3 -V
Python 3.7.3

I think you just need to do

cd ~
rm -rf ~/.nvm
rm -rf ~/.npm

then try node -v
go back into your ~/.node-red directory and redo the npm install and npm install node-red-contrib-i2c@latest

I've rebooted and typed commands you suggested:

Last login: Fri Jul  9 21:06:08 2021 from 192.168.24.1
pi@RaspbFranco:~ $ cd ~
pi@RaspbFranco:~ $ rm -rf ~/.nvm
pi@RaspbFranco:~ $ rm -rf ~/.npm
pi@RaspbFranco:~ $ node -v
v14.17.2
pi@RaspbFranco:~ $ cd .node-red
pi@RaspbFranco:~/.node-red $ npm install

up to date, audited 749 packages in 2m

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

25 vulnerabilities (2 low, 6 moderate, 15 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
pi@RaspbFranco:~/.node-red $ npm install node-red-contrib-i2c@latest

up to date, audited 749 packages in 2m

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

25 vulnerabilities (2 low, 6 moderate, 15 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
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.
^C
pi@RaspbFranco:~/.node-red $ node-red --safe
10 Jul 00:05:31 - [info]

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

10 Jul 00:05:31 - [info] Node-RED version: v1.3.5
10 Jul 00:05:31 - [info] Node.js  version: v14.17.2
10 Jul 00:05:31 - [info] Linux 5.10.48-v7+ arm LE
10 Jul 00:05:33 - [info] Loading palette nodes
Initializing HAP-NodeJS v0.9.4...
10 Jul 00:05:42 - [info] Dashboard version 2.30.0 started at /ui
10 Jul 00:05:43 - [warn] ------------------------------------------------------
10 Jul 00:05:43 - [warn] [node-red-contrib-i2c/i2c] Error: The module '/home/pi/.node-red/node_modules/i2c-bus/build/Release/i2c.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 93. 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`). (line:3)
10 Jul 00:05:43 - [warn] ------------------------------------------------------
10 Jul 00:05:43 - [info] Settings file  : /home/pi/.node-red/settings.js
10 Jul 00:05:43 - [info] Context store  : 'default' [module=memory]
10 Jul 00:05:43 - [info] User directory : /home/pi/.node-red
10 Jul 00:05:43 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Jul 00:05:43 - [info] Flows file     : /home/pi/.node-red/flows_RaspbFranco.json
10 Jul 00:05:44 - [error] Uncaught Exception:
10 Jul 00:05:44 - [error] Error: listen EADDRINUSE: address already in use 0.0.0.0:1880
    at Server.setupListenHandle [as _listen2] (net.js:1320:16)
    at listenInCluster (net.js:1368:12)
    at doListen (net.js:1505:7)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
pi@RaspbFranco:~/.node-red $

there is a slight change, node red start stucks, after one minute I've terminated with control C and launched safe mode

I'm uninstalling the node-red-contrib-i2c and reinstalling

EADDRINUSE - means the service is still running so you need to stop that first...
BUT - it still says wrong node_module version - so do a npm rebuild - and then restart again.

how can I stop it?

node-red-stop

Got ti, when I've pressed control C
So I uninstalled it, rebuilt, installed again, yes now disappeared, bu ncd comm not working
10 Jul 00:15:31 - [info] - ncd-comm
10 Jul 00:15:31 - [info] - LCD20x4-I2C

OK - so did you npm i node-red-contrib-lcd20x4-i2c ?
Do you really need ncd-comm ? - Are you using that node ?

I really don't know what it is, I was thinking it is a dependency, how can I remove it? It's hidden node.. in packajge.json there is not.
Now I install LCD.
I've checked flows, probably it was related to AD1115 module, can I remove this line.. I suppose I can
{"id":"2ab606d1.4ab30a","type":"ncd-comm","name":"We","bus":"i2c-1","commType":"standard","addr":"0","useMux":false,"muxAddr":"112","muxPort":"0"},