【发布时间】:2017-01-02 08:23:29
【问题描述】:
我无法理解为什么 pm2 在开发而不是生产中启动我的 ghost 博客。
我可以运行这个
npm start --production 一切都如我所愿。但是如果我尝试使用 pm2
pm2 start index.js 它开始了我的博客开发,我不想这样做。我一定是盲人,但在文档中看不到如何强制 pm2 以生产模式启动。
我只能像这样使用 npm 成功启动应用程序:
npm start --production
我尝试使用配置文件 ecosystem.config.js 并像这样启动它:
pm2 start ecosystem.config.js 或
pm2 start ecosystem.config.js --env production 但它似乎是从开发开始的。这是我的配置文件。
module.exports = {
apps : [
{
name : "asle",
script : "index.js",
env: {
COMMON_VARIABLE: "true"
},
env_production : {
NODE_ENV: "production"
}
}
]
}
【问题讨论】: