deployment issue with create-react-app and heroku (server= express)
Is this a bug report?
may be yes, because running after the command npm run build it say's
The project was built assuming it is hosted at /resume/. where as i don't have anyting like resume
Did you try recovering your dependencies?
yes
Which terms did you search for in User Guide?
i have followed the whole document for deploying it for heroku.. but it is throwing error
Environment
node - 8.11.3 npm - 5.6.0 express: 4.16.3,
Steps to Reproduce
(clone the repo from below link and get started)
Expected Behavior
expecting to get depolyed
Actual Behavior
blank screen is coming with error in #1812
Reproducible Demo
https://github.com/shivasai09/resume
I took a quick look at your repo and it appears you are serving every request with index.js here: https://github.com/shivasai09/resume/blob/master/server/app.js#L442
This means that if the browser requests a javascript file, the server will respond with the contents of index.html, which would cause the error in #1812. You should make sure that the js files are served appropriately.
i have added that line because it was showing me the black screen in deployment.. eventhough if i remove it , no change in the prodcution
I would follow a tutorial on how to setup express with cra: https://medium.freecodecamp.org/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0
Specifically you should be serving all build files like this:
app.use(express.static(path.join(__dirname, 'client/build')));
did this tutorial worked for you @bugzpodder ?
I don't have any reason to believe this approach wouldn't work.
@bugzpodder i did all the changes he told but still no luck.. the sad part is i followed the tutorial and did that project that was working but my project is not can't figure what is wrong
Can you rebuild your project and deploy again?
This message:
The project was built assuming it is hosted at /resume/.
should only show up if you specified something ending with /resume/ in homepage of your package.json. I don't see homepage there so you probably removed it. Try building again?
@gaearon i can't belive that you are also trying to help me, i am very happy. and would like to say that i have succesfully deployed my app to heroku and it is working fine thanks to @bugzpodder for showing me the tutorial
https://medium.freecodecamp.org/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0
the problem was i have removed the line
registerServiceWorker(); from my index.js and was struggling hard and changing everything like a mad
but now i am not fully succeded the tutorial which have been provided by the @bugzpodder
https://medium.freecodecamp.org/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0
in that he has created a app and deployed to https://cra-express.herokuapp.com/
so when i am trying to open this url in (browser)safari i am still getting a blank screen
go ahead and open this in your safari browser
safari version - 5.1.7(7534.57.2)
note- i am running this browser on windows 10 pro
so now i leave this issue to you @gaearon if you feel that the tutorial was right and if you think that it should have also worked in safari as it was working in chrome then i think there is definetly some bug or if you feel it is browser problem then go ahead and close this issue
but i request you to relpy me what is the problem and why it is not working in safari as expected and then close the issue if you want to do so
Please check the console in safari, you might be using a language feature that you need to provide a polyfill for!