Reputation: 3397
I downloaded the starter kit for react and redux. It's really nice and works fine in localhost with the command npm run dev
but I'm not able to deploy it on the server.
First, I use the command npm run deploy
which clean and compile my src
folder in the dist
folder. Then, I deploy the server on Heroku. Once all is built, the server run npm start
which execute the command babel-node bin/server
. This command is not recognized by the heroku server.
I would really appreciate if someone could help me to debug this. I tried to clone again the repo, then :
npm install
npm run deploy
Upvotes: 3
Views: 1491
Reputation: 1793
The reason it doesn't work on heroku is because there isn't any production server ready in this project for your deployment as specified here : https://github.com/davezuko/react-redux-starter-kit#deployment
When you run the npm run deploy
command, all the front-end code is compiled in the /dist
folder.
In order to deploy it on heroku you need to :
Create a very simple http server always serving the file index.html. Here is the main part using Express or Koa
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/dist/index.html'));
});
Modifying the npm start
script in order to target this new production ready server.
Upvotes: 1