如何使用pm2永久运行解析仪表板?我尝试过以下方法:
dashboard.json
{
"apps" : [{
"name" : "parse-dash”,
"script" : "/usr/local/bin/parse-dashboard”,
"watch" : true,
"merge_logs" : true,
"cwd" : "/home/parse",
"args" : "--config dashboard-config.json"
}]
}
并开始pm2:
pm2 start dashboard.json
但是我收到以下错误:
evalmachine.<anonymous>:3
"name" : "parse-dash”,
^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected token ILLEGAL
at Object.exports.runInThisContext (vm.js:53:16)
at Object.module.exports.parseConfig (/usr/local/lib/node_modules/pm2/lib/Utility.js:145:17)
at Object.CLI._startJson (/usr/local/lib/node_modules/pm2/lib/CLI.js:302:23)
at Object.CLI.start (/usr/local/lib/node_modules/pm2/lib/CLI.js:98:9)
at /usr/local/lib/node_modules/pm2/bin/pm2:249:13
at /usr/local/lib/node_modules/pm2/node_modules/async/lib/async.js:181:20
at replenish (/usr/local/lib/node_modules/pm2/node_modules/async/lib/async.js:319:21)
at /usr/local/lib/node_modules/pm2/node_modules/async/lib/async.js:330:15
at Object.async.forEachLimit.async.eachLimit (/usr/local/lib/node_modules/pm2/node_modules/async/lib/async.js:220:35)
at Command.<anonymous> (/usr/local/lib/node_modules/pm2/bin/pm2:248:13)
我不熟悉node_modules,我不确定我是否指向正确的文件夹。
答案 0 :(得分:4)
嗨,大家,你救了我的命,我也只是在找一个解决方案。 代码中的问题是在这些行上分隔的最后一个逗号:
"name" : "parse-dash”,
"script" : "/usr/local/bin/parse-dashboard”,
更改为:
"name" : "parse-dash",
"script" : "/usr/local/bin/parse-dashboard",
希望它有所帮助。