Skip to content

Updating nodejs

Julian Waller edited this page Apr 16, 2024 · 6 revisions

Nodejs often makes new releases. In the major version jumps, these can include some breaking changes which could impact your module, so we don't want to do that without you being aware of it.

For the initial release of 3.0, we require modules to be compatible with nodejs 18. In future releases we intend to allow modules to choose the version (to allow for a gradual conversion process), but this is not in place yet. Once it is possible, you can refer to this page to go through the steps to update.

When developing your module, you need to have a similar version of nodejs installed, for when you run yarn. But when companion runs your module, it will do so with a version of nodejs that has been bundled into the application.
We are looking into making it possible for module authors to use this version of nodejs instead of needing to install it themselves.

If you are using a node version manager, you can install an updated nodejs to your system, by doing something like fnm install 18 and fnm use 18.

Changing your module's version of nodejs

Companion knows what version of nodejs your module is compatible with by looking at the companion/manifest.json in your module. Inside the runtime object, is a property type which should be set to something like node18. Currently node18 is the only valid value, others will be allowed in the future. If this is an unknown value, your module will fail to run when adding an instance inside Companion.

To change the version your module is using, set this value to an appropriate version. For now this must be node18, a list of acceptable values will be added here when possible.

Make sure that your version of the @companion-module/base dependency is appropriate for the version of Companion too. A table of compatibility is listed in the readme

If you are using typescript, you should update your preset to have sensible target and lib values. If you are using a preset from @companion-module/base, then check for one designed for the same version of nodejs.

If your module has an engines field in the package.json, make sure that has a sensible value.

Once you have done this, give it a test in Companion and ensure everything is working as expected.

Clone this wiki locally