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 !!

1 Like