Node-Red Pm2 设置

Node-Red Pm2 Setup

我正在尝试使用 pm2 在 raspberry pi 2 上启动我的 node-red。我正在使用启动命令:

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

起初它似乎有效:

但不幸的是它出错了:

这就是日志:

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)

请确保您安装了最新的 PM2 版本 (>2.x):

$ npm install pm2@latest -g
$ pm2 update

然后再次启动 node-red,它应该按预期工作:

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