Running Node-RED on GitHub

Building and running code from source is only suitable for users who are happy to work with development code, or developers who want to contribute to the project.

prerequisites

To run Node-RED from source you need:

Supported Node.js versions.

a git client

Globally installed grunt-clinpm module:

sudo npm install -g grunt-cli

Clone the code and install dependencies

You can clone the source repository directly from GitHub:

git clone https://github.com/node-red/node-red.git

This will create a directory called node-red in the current directory containing the complete source code of the project. The remainder of these instructions assume that you are in that directory.

You should then select the branch you want to build from.

master – the default branch. This is the maintenance branch that contains the current stable version of the code, as well as any bug fixes that are applied before the next maintenance release.

dev – development branch. This is where all the new developments happen.

If you want to use the dev branch you should run the command:

git checkoutdev

Once you are on the branch of your choice, you should install all dependencies using the following command:

npm install

Build Node-RED

Before starting Node-RED, you must build it. This can be done using the following command:

grunt build

Run Node-RED

You can then run Node-RED using the following command:

npm start

If you want to pass any command line parameters, you must use the following syntax:

npm start —

The –argument tells npm to pass any of the following arguments to the command it runs.

Automatic restart

If you are editing source code, you must restart Node-RED to load changes.

A special grunt task is provided to automate this operation.

grunt dev

This command will build and run Node-RED, then monitor the file system for any changes to the source code. If it detects changes to the editor code, it will rebuild the editor component and you can reload the editor to see the changes. If it detects changes to the runtime or nodes, it restarts Node-RED to load those changes.

This mode does not allow you to pass parameters to the Node-RED command other than specifying a different stream file:

grunt dev –flowFile=my-flow-file.json

Keywords: industrial gateway

X

Contact us

Contact us