Updating Node Red and Node.Js on Robustel Enterprise Gateway (or reverting to factor defaults)

Hello,

We recently tried updating the Node Red and Node.JS version on the Robustel EG5120 Edge Computer / Gateway . However, upon updating to Node.JS V20, there was an error, and the serial bindings appeared to have broken. See below:

Initial Situation:
Updated Node.js to version 20.15.0
This caused compatibility issues with @serialport/bindings and NCD nodes

Steps Taken:

Downgraded Node.js to version 16.19.1 using NVM
Reinstalled Node-RED and its dependencies
Installed @serialport/bindings@9.2.9 (as the newer versions were incompatible)
Installed @ncd-io/node-red-enterprise-sensors@1.0.2 and ncd-red-comm

Errors Encountered:

Serial bindings issues:
Error message: β€œCould not locate the bindings file. Tried: [list of paths]”
This occurred even after installing the specific version of @serialport/bindings
Warning: β€œMissing node modules: ncd-red-comm (2.0.0): ncd-comm”

Additional Attempts to Fix:
Cleaned npm cache
Rebuilt dependencies
Updated and reinstalled NCD nodes

Are there known compatibility issues between the latest Node-RED/Node.JS and the NCD Enterprise Sensors? Is there an issue with updating to Node Red 4. and Node.JS 20?

Is there a specific version of @serialport/bindings that is known to work with this setup?
Are there any additional steps I should take to resolve these issues?

How do I reset the configuration to the factory settings? Do you have an image file I can use or steps to take to reset it so that everything works?

Any assistance or guidance would be greatly appreciated. Thank you in advance for your help!

Hi @tulanowski

I have upgraded to Node-RED version 4.0.0 and Node.js version 20.15.0, and reinstalled the @ncd-io/node-red-enterprise-sensors library in version 1.0.2 It is now communicating correctly.
nr_4_ncd

Could I ask you what was the procedure you used to update Node-RED and Node.js?

I could recommend you the following procedure:

  1. Delete Nodes and Configuration Nodes:
  • In the Node-RED editor, delete the β€œWireless Gateway” and β€œWireless Device” nodes you have.
  • Also delete the configuration nodes. These appear in the β€œConfiguration nodes” tab. Select the node and press the β€œDelete / delete” button (at the end click on Deploy button).
    configuration_nodes
  1. Uninstall Libraries:
  • Uninstall the @ncd-io/node-red-enterprise-sensors and ncd-red-comm libraries. You can do this either from the Node-RED editor or via npm:
    cd .node-red
    npm uninstall @ncd-io/node-red-enterprise-sensors
    Note: it is probably you get an error during uninstall β€œncd-red-comm” it is okay.
    uninstall_lib
  1. In terminal stop Node-RED, then use the following official script to update Node-RED and its dependencies. Note: When prompted to install Raspberry Pi nodes, select β€˜No’ option.
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
  1. Once Node-RED is updated use the following commands to update Node.js:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable

You can corroborate the node.js version using:

node -v

Note: If node -v shows the old version then start a new terminal.

  1. Now star Node-RED and reinstall the @ncd-io/node-red-enterprise-sensors library from β€œManage Palette”.

This procedure should work, I hope you find the information useful, let me know if you have any issues during the process.
Thanks,
Eduardo M.

Hi,

You can also try these commands from the command line or an exec node:

Command line:
cd ~/.node-red
npm install
npm rebuild
pm2 restart all

exec node:
cd ~/.node-red ; npm install ; npm rebuild ; pm2 restart all

These commands will update all libraries and rebuild all libraries for the current nodejs install.

Or you can back up your flows using node-red’s export and do a factory reset via the web configuration UI > System > Profile > Default Configuration Section > Restore to Factory Default Configuration.

nvm is useful, but I would just recommend using these commands to update without the version management layer as it can cause odd issues with compiled libraries like the serial port library if you’re not used to it or don’t set default runtimes etc.

To update I would recommend these commands:

Commands:
sudo n $version
sudo n prune
sudo reboot

After reboot run these commands:
sudo npm install -g --unsafe-perm node-red
cd ~/.node-red
npm rebuild
pm2 restart all

You might not have to reboot after the n prune command, but I did during my testing to make sure it was a clean service environment.

1 Like

Amazing! This is great information!

For anyone that is wondering, this worked well for me:

  1. Used the Factor Reset option via the web configuration as per @jacob
  2. Followed @Eduardo_Mtz 's instructions, including bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) to update node red and Node.JS

I also specified installing Node.js V20, and everything worked very well!

I did experience an issue with node red not loading properly after the reset I added the NCD Gateway node, but that’s because it was looking for the wrong serial port (I chose the incorrrect one), and causing an issue for some reason.

So I used the following steps to delete the flows using ssh, and that seemed to clear things up:

To view and delete flows via SSH in Node-RED, you can follow these steps:

  1. View flows: The flows are typically stored in a JSON file. By default, this file is usually named flows.json and located in the Node-RED user directory (usually ~/.node-red/). To view the contents of this file:

cat ~/.node-red/flows.json

  1. Delete flows: Deleting flows is essentially replacing the content of the flows file with an empty array. Here’s how you can do it: a. First, make a backup of your current flows:

cp ~/.node-red/flows.json ~/.node-red/flows_backup.json

b. Then, replace the content of the flows file with an empty array:

echo β€˜β€™ > ~/.node-red/flows.json

c. After doing this, you’ll need to restart Node-RED for the changes to take effect.

After all this, Node Red fired up properly and I was running Node Red 4.0 and Node.JS v20 without any issues!

Thanks again !!

2 Likes

Hi. I’m having an issue with node-red. I added a status node and then it seems like node-red crashed. Now I’m not able to access node red from the browser either from the wifi or if plugged in on eth 1.

Can you help me get back into node red and roll back or at least upload the last stable config?

What I usually do is ssh into the Gateway and use these commands:

mv ~/.node-red/flows.json ~/.node-red/flows.json.backup
pm2 restart all

This empties your flow and backs it up to a file called flows.json.backup and restarts node-red.

thanks, I followed these instructions to enable ssh.

What command do I need to run to get into the I tried
ssh ncdio@192.168.0.1
the then it doesn’t run those commandas


Ok, so I followed the commands and was able to reset it…

Last login: Mon Feb 17 12:23:38 on ttys000

dannguyen@Dans-Air ~ % ssh ncdio@192.168.0.1

The authenticity of host β€˜192.168.0.1 (192.168.0.1)’ can’t be established.

RSA key fingerprint is SHA256:pukdlvQsdNu7r99Thpu/y8Y4QomQ0neLigruUM76UmU.

This key is not known by any other names.

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added β€˜192.168.0.1’ (RSA) to the list of known hosts.

(ncdio@192.168.0.1) Password:

(ncdio@192.168.0.1) Password:

The programs included with the Debian GNU/Linux system are free software;

the exact distribution terms for each program are described in the

individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent

permitted by applicable law.

ncdio@NCD-Edge-A9EB:~$ mv ~/.node-red/flows.json ~/.node-red/flows.json.backup

ncdio@NCD-Edge-A9EB:~$ pm2 restart all

Use --update-env to update environment variables

[PM2] Applying action restartProcessId on app [all](ids: [ 1 ])

[PM2] node-red βœ“

β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ id β”‚ name β”‚ mode β”‚ β†Ί β”‚ status β”‚ cpu β”‚ memory β”‚

β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚ 1 β”‚ node-red β”‚ fork β”‚ 1 β”‚ online β”‚ 0% β”‚ 22.6mb β”‚

β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Module

β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ id β”‚ name β”‚ status β”‚ cpu β”‚ mem β”‚

β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚ 0 β”‚ pm2-logrotate β”‚ online β”‚ 1.1% β”‚ 53.4mb β”‚

β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

ncdio@NCD-Edge-A9EB:~$ exit

logout

Connection to 192.168.0.1 closed.

dannguyen@Dans-Air ~ %

Can you run the command:
pm2 logs node-red --lines 1000

This will print out the last 1000 lines of the log and should tell us what’s throwing the error.

You can also run this command from ~/.node-red
ls -al

This would tell us if the previous commands actually managed to move the flows.json file correctly.