Friday 21 April 2017

Heroku build failing on react app

I am deploying my react app to heroku, the express express production server works fine on my local machine but the app is crashing on Heroku and i cannot seem to find why. Here are the logs

npm ERR! cross-env NODE_ENV=production node server

npm ERR! You can get information on how to open an issue for this project with:

npm ERR! npm bugs i2x

npm ERR! Or if that isn't available, you can get their info via:

npm ERR! npm owner ls i2x

npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

npm ERR! /app/npm-debug.log

at=error code=H10 desc="App crashed" method=GET path="/" host=challenge-ahsan.herokuapp.com request_id=e6cb2ec0-6a7b-4378-ba64-5a0f5a3c8dd4 fwd="45.116.232.11" dyno= connect= service= status=503 bytes= protocol=https

at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=challenge-ahsan.herokuapp.com request_id=8e437da7-f214-4f9d-b498-a71ab07250b7 fwd="45.116.232.11" dyno= connect= service= status=503 bytes= protocol=https

I read that this usually occurs if you're hard setting the port and should use process.env.PORT instead which i already am.

my npm scripts are as follows:

"scripts": {
    "start": "cross-env NODE_ENV=production node server",
    "dev": "cross-env NODE_ENV=development webpack-dev-server  --config ./webpack/webpack.dev.js --hot --inline",
    "build": "rm -rf dist && webpack --config ./webpack/webpack.prod.js --progress --colors",
    "test": "jest"
},

and my server files reside in root-directory/server

server/index.js

server/server.js



via Rizvified

No comments:

Post a Comment