-
-
Notifications
You must be signed in to change notification settings - Fork 160
Updating to Node.js 16
Starting with Signal K(SK) server version 1.41.0 (in beta when writing this) the recommended Node.js version is 16. 16 is the active LTS (Long Term Support) version in Jan 2022, with End of Life set at 2024-04-30. Node 10 is past its end of life and won't receive any (security) updates.
While the server proper still works as of 1/2022 with Node 10 we recommend updating to Node 16. Node version update requires reinstalling the server and the plugins that have dependencies with native extensions need to be reinstalled to be compatible with a newer Node major version.
The best way to upgrade, to Node.js 16, is to start from scratch with a new OS and doing a new SK install, but with some fixes, described below, an existing installation, can hopefully be upgraded.
If using a Raspberry Pi(RPi) please use Buster OS ! The newest OS, Bullseye, is not fully tested.
It's highly recommended that you have a backup. This blogpost describes how to create a bootable copy of your existing installation. The method can also be used to create a bootable SSD or USB drive.
In a terminal/ssh session issue the following
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g npm@latest
Use the following command to check the install
node -v && npm -v
which will report, something like, v16.13.2, 8.3.1
which are the versions of "node" and "npm"
As said, the SK server, now is in beta so issue the command
sudo npm install -g signalk-server@1.41.0-beta.4
There will be some warnings shown but no errors should occur.
In a browser use the SK Dashboard to check if it's working. In the box "Connection & Plugin Status" below column "Last Error" red text will report an error.
Probably some plugin errors will occur and they are due to the Node upgrade. These plugins must be reinstalled. The plugin with the error will not be visible in the "Appstore => Installed" so we have to uninstall manually.
Uninstall example.
As an example the @signalk/charts-plugin
will stop working due to a SQL change i Node 16. So to uninstall this plugin position yourself in the .signalk
directory with cd ~/.signalk
and then command
sudo npm uninstall @signalk/charts-plugin
and then reinstall the plugin again from the Appstore.
Serial ports.
Other plugins that will fail are the ones using serial ports for example @signalk/vedirect-serial-usb
@signalk/signalk-node-red.
If you are using Node-Red please update to the latest version and be aware of that nodes that use serial ports have to be reinstalled/upgraded. As an example the node node-red-node-serialport
.
Other errors.
It could also be that the failed plugin is not updated to use Node 16 and therefore you have to contact the developer. In Appstore at every plugin line there is "I" which you can click on. This will take to the NPM website and at the right you will find "Repository". Click on that link and at Github create an issue.
Under Linux, depending on the migration method, the location of the node
binary may change. It can be located at /usr/bin/node
or /usr/local/bin/node
and sometimes both.
Check the contents of the PATH variable and which version of node
it will use first. If possible clean it up so that you only have one.
If some warnings appear during the Signal K server update, the messages below do not prevent the server from working properly.
The corrections are being implemented...
- npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
- npm WARN deprecated uuid@3.3.2: 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 debug@4.2.0: 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 core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
- Node-RED: starting with v2.12.0 uses Node-RED v2 that is no longer supported on Node 10
- signalk-to-nmea2000@2.13.0: work with Node 16 even with the following message
WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'signalk-to-nmea2000@2.13.0', npm WARN EBADENGINE required: { node: '10' }, npm WARN EBADENGINE current: { node: 'v16.13.2', npm: '8.1.2' }