Search code examples
javascriptiotpm2node-red

Node-Red Pm2 Setup


I am trying to start my node-red on a raspberry pi 2 using pm2. I am using the startup command:

pm2 start /usr/bin/node-red-pi --node-args="--max-old-space-size=128" -- -v

At first it seems to work:

NodeRed Startup pm2

But unfortunatly then it errors:

NodeRed Error pm2

Thats the log:

SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function._load (/usr/local/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:28:21)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)

Solution

  • Please make sure you installed the latest PM2 version (>2.x):

    $ npm install pm2@latest -g
    $ pm2 update
    

    Then start node-red again, it should works as expected:

    pm2 start node-red --node-args="--max-old-space-size=128" -- -v