如何使用forever.json运行npm脚本?

问题描述 投票:0回答:1

我想永远使用npm脚本(例如npm start)。我知道此命令:

forever start -c "npm start" /path/to/app/dir/

但是我如何将其广告到这样的json文件中

[
  {
    // App1
    "uid": "app1",
    "append": true,
    "watch": false,
    "script": "-c npm start", // doesn't work
    "sourceDir": "/path/to/app/dir"
  }
]
npm forever
1个回答
0
投票

您不能直接将npm start添加到脚本中,因为您已经知道script属性仅用于指定应用程序的主入口点,可能需要使用一些args。

"scripts" : { "start" : "node server.js" } }

其中server.js是:-

http.createServer(...).listen(process.env.npm_package_config_port)
© www.soinside.com 2019 - 2024. All rights reserved.