Thanks. It solved my problem on Heroku, but I can't run my app locally.
After installing serve and modifying package.json, when I run npm start - serve says the app is available on port 5000 but I'm getting 404 page there. (it doesn't work also on port 3000 which was the one that I used so far).
Any ideas why?
I am glad to hear this worked for you.
Just a side note:
commands like npm start can work directly because they are default commands from npm but custom commands like dev set by the user would only work with the run command. npm run dev. I hope this clears things up.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks. It solved my problem on Heroku, but I can't run my app locally.
After installing serve and modifying package.json, when I run npm start - serve says the app is available on port 5000 but I'm getting 404 page there. (it doesn't work also on port 3000 which was the one that I used so far).
Any ideas why?
Hi Haim,
If you run yarn start/npm start now it points to 'serve -s build' instead of 'react-scripts start'.
Make sure you've added below:
"dev": "react-scripts start",
"start": "serve -s build",
and to run your app locally do npm run dev not npm start
Thanks. It didn't work with "npm dev" (I got that "dev" is invalid command), but it did work with "npm run dev".
I am glad to hear this worked for you.
Just a side note:
commands like
npm start
can work directly because they are default commands from npm but custom commands likedev
set by the user would only work with therun
command.npm run dev
. I hope this clears things up.