Node-RED Standalone Executable

@jgreenmt

Start to Finnish (I have just tested this on OSX)

Create working directory, install Node RED

mkdir NodeRED
cd NodeRED
npm install node-red

Hard Install some nodes (using dashboard as example)

npm install node-red-dashboard

Modify package.json (NodeRED/package.json)

/* Before */
{
  "dependencies": {
    "node-red": "^3.0.2",
    "node-red-dashboard": "^3.4.0"
  }
}

/* After */
{
 "name": "Node-RED",
 "bin": "node_modules/node-red/red.js",
 "pkg":{
    "assets": ["./node_modules/**/*.*"]
  },
  "dependencies": {
    "node-red": "^3.0.2",
    "node-red-dashboard": "^3.4.0"
  }
}

Build Binary (it will also embed any nodes you installed in step 2)

pkg . -t host

Run Binary (or move it to a new system) <- only binary is needed

Node-RED --userDir /some/dir

There are pros and cons to hard installing nodes.

  • No need to transport large node_module folders
  • Can't remove or update hard installed nodes (as they are embdded)

So hard installing nodes is optional, but for nodes you need, you will need to install them normally if not embedding them

4 Likes