1

I have a full-stack project's working directory looks like:

|__ server
|
|__ client
|
|__ node_modules
|
|__ package.json

  • In folder server is a NodeJs for backend
  • In folder client is a ReacJs for frontend
  • Here is the code in package.json in the root folder:
{
  "name": "kmail",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "client": "cd client && npm start",
    "server": "cd server && npm start",
    "start": "concurrently - kill-others \"npm run server\" \"npm run client\""
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "concurrently": "3.5.1"
  }
}

When I run the project locally, it works fine. However, when I deploy it to Heroku, it failed and here is the logs I got:

Starting process with command 'npm start'
concurrently - kill-others "npm run server" "npm run client"
concurrently - kill-others: not found

Do you know any solution to fix this? Or is there any host service other than Heroku that can help to solve my problem? Thank you very much.

Sang Lê
  • 41
  • 3
  • Does this answer your question? [Deploy the backend and frontend on the same Heroku app/dyno](https://stackoverflow.com/questions/36504768/deploy-the-backend-and-frontend-on-the-same-heroku-app-dyno) – Michael S. Apr 21 '20 at 23:26
  • This [answer I just posted](https://stackoverflow.com/questions/36504768/deploy-the-backend-and-frontend-on-the-same-heroku-app-dyno/61354113#61354113) to a similar question, using a proxy and a heroku-postbuild step, would allow you to deploy to Heroku as one app (but also run it locally with one command, through concurrently). – Michael S. Apr 21 '20 at 23:23

2 Answers2

0

Well, "start" script should start the server part

"start": "node index.js --prefix server"

Heroku looks for "start" script and actualy use it to run the app.

Try changing it, and if error persist paste the whole log here

JozeV
  • 616
  • 3
  • 14
  • 27
0

I think is --kill-others not - kill-others

"start": "concurrently --kill-others \"npm run server\" \"npm run client\""
joseluismurillorios
  • 1,005
  • 6
  • 11