Deploying a React App (Command "start" not found)

Hello,
I’m trying to deploy a React App with the Web Service,
The environment is Node, Build Command is yarn and for Start Command, I have yarn start, but then after building successfully, when Starting service with ‘yarn start’, I get this error
’ error Command “start” not found.’
I’m not sure if it is related to the fact that there is no start command inside the scripts of the package.json file? in there I just have dependencies:
{
“dependencies”: {
“request”: “^2.88.2”,
“uuid”: “^9.0.0”,
“uuidv4”: “^6.2.13”
}
}
However I have ‘start’ command inside the scripts of the package.json files that are in clinet (“start”: “react-scripts start”,) and server (“start”: “nodemon index.js”) folders.
Do I need to add start command in package.json in root of the project and what should it be ?
or do I need to separate frontend and backend folders and put them in separate repos?
Thank you!

Hi,

Yes, this is likely due to not having a start script in the package.json in the root of your repo. I would recommend adding that with whatever start command you have to start your service. If you are using React, then I believe react-scripts start is the default.

1 Like

Also check out this guide: Deploy a Create React App Static Site | Render

You should be able to deploy a react app with Static webs instead of web service. All you need to is go to your apps settings on Render and:

  1. Set the build comman which usually is react-scripts build
  2. Set the publish directory which with react-scripts is ./build
  3. Set rewrites if you’re usiing client side-routing e.g react router.
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.