Setting Up Node-RED

To begin, create a directory called nodered to house your Node-RED-based code. Then open a terminal to this directory and create an initial package.json.

​ ​$ ​​npm​​ ​​init​​ ​​-y​

Next, install the node-red package locally.

​ ​$ ​​npm​​ ​​install​​ ​​--save​​ ​​--save-exact​​ ​​node-red@0.16.2​

Then open your package.json in a text editor and add a start script to the scripts section like so:

​  ​"scripts"​: {
» ​"start"​: ​"node-red -v -u ./config -f ./config/flows.json"​,
​  ​"test"​: ​"echo ​​\"​​Error: no test specified​​\"​​ && exit 1"​
​  },

Here we’re specifying a couple of command-line arguments to the ...

Get Node.js 8 the Right Way now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.