Node-RED: How to Change the Underlying Node.js Version

1 min read

Node-RED is an open source programming tool for wiring hardware devices and services on the Internet and APIs.

IBM Cloud offers a pre-configured Node-RED app kit on its Cloud Foundry (CF) space

There are times where users encounter underlying Node.js errors when launching the app due to internal changes. This post will outline how to modify pre-configured settings to resolve any errors you may encounter.

Error example

The application log shows the following error:

"Unable to install node: no match found for 6.x in [8.16.0 8.16.1 10.16.0 10.16.3 12.7.0 12.8.1]"

This error indicates that the underlying Node.js version is outdated and cannot start the application. Therefore, restarting the application results in the same error.

Step 1: Enable the continuous delivery feature

First of all, you need to enable the continuous delivery feature. Continuous delivery allows you to store the source code of the Node-RED application on an IBM Git repository and modify its packages and other fields.

  1. Open your resource list.
  2. Open the application in question. Select the Overview tab from the left menu.
  3. Click the Enable icon under Continuous delivery.
    Click the Enable icon under Continuous delivery.

  4. Define your repository information and input the API key.
  5. By default, the IBM Git repository and toolchain (code build and deployment) are included. You can create a new API key if you want.
  6. Once you define all values, click Create.
    Once you define all values, click Create.

Step 2: Modify the underlying Node.js package

  1. Once continuous delivery creation completes, the toolchain is configured. Now, click Git under the CODE section. The IBM Git repository where the Node-RED code is stored will open.
  2. Open the package.json file in the root directory of the repository.
  3. Click Edit and modify the engine part of the code to the version supported. FROM:
     "engines": {
     "node": "6.x"
     }
    TO:
    "engines": {
     "node": "8.x"
     }
  4. Click Commit changes, which triggers the toolchain to automatically build and deploy your application:
    Click Commit changes, which triggers the toolchain to automatically build and deploy your application:

Next steps

By following these steps, you're now able to change the underlying Node.js version. The IBM Cloud platform evolves every day, so there is the chance that the version of Node.js you are running will become unsupported. If this happens, you can apply the same steps to overcome the problem. Also, enabling the continuous delivery feature allows you to customize your Node-RED. 

For more information on Node-RED, see their page on "Packaging."

Node-RED is an open source program, so if you need more help, you can always contact community members by posting questions on the forum.

Be the first to hear about news, product updates, and innovation from IBM Cloud