如何在部署时在Heroku上运行多个npm脚本?

时间:2018-02-03 19:03:23

标签: node.js heroku

在我的package.json我有以下脚本:

"scripts": {
    "api": "node ./api/index.js",
    "client": "node ./client/index.js",
    "start": "npm run client && npm run api"
  },

我正在尝试运行start,这会启动我的客户端(反应前端)和api。在我的Procfile中,我有:web: npm run start。 Heroku构建成功,但只有第一个脚本运行。我的应用程序部署到Heroku后,有没有办法从我的Procfile运行多个npm脚本?

1 个答案:

答案 0 :(得分:0)

Heroku multi dyno这将为您提供帮助 只需在每个命令末尾输入&,并在末尾输入wait -n

相关问题