我的节点应用部署在/ opt / hello / current中 但是当我使用以下的ecosystem.json启动PM2(pm2 startOrReload ecosystem.json --env production)时,它似乎没有考虑到给定的参数......
EmpID Name
---------------
12 Name2
它应该从“cwd”(/ opt / hello / current)相对启动脚本(./hello.js)......我错了吗?
目前以路径/opt/hello/hello.js
开头答案 0 :(得分:2)
你需要为cwd指定目录路径,在这种情况下,只需在末尾添加一个/,如下所示:
"apps" : [
{
"name": "hello",
"cwd": "/opt/hello/current/", // / added here
"script": "./hello.js",
"args": "",
"watch": false,
"node_args": "",
"merge_logs": true,
"env" : {
"NODE_ENV": "development"
},
"env_staging" : {
"NODE_ENV": "staging"
},
"env_production" : {
"NODE_ENV": "production"
}
}]