I would like to deploy my react app onto my personal website. I currently have it deployed onto to heroku and have that linked on my personal site. But I would like to eliminate heroku from the equation and have everything on my own site. Whenever I try to deploy it, I upload the build files into my file manager public_html. But when I try to open it, all I get is a blank page.
I have my vanilla JS projects up just fine.
My question is how do I deploy my react app, through cpanel, onto my existing site.
I’ve read through some stack pages already and tried npm run build and posting the zip files as well as the normal files to my cpanel file manager. But it only gives me a blank page.
When I open up dev tools for the blank page I can see that it is the html file I want but and it has the links to my build files but it’s just not running them for some reason. The console is giving me an error “Failed to load resource: the server responded with a status of 404 ()”
I’ve tried changing the homepage destination as well.
I believe I’m just missing something really simple because I’m having a hard time finding any help on this one. I’m relatively new to react and deploying react apps so if someone could help me I would be very grateful.
I don’t know if I am uploading the files to my file manager in cpanel wrong or if I’m doing something wrong with npm run build.
My git repo is here
https://github.com/brandondorner/4-Day-Forecast-Weather-App
Thank you.
2
Answers
To deploy your react app into your web site just follow these steps :
I have tested these steps using create-react-app this is the ordinary way to do it, if it doesn’t work then try to check the error from the browser console
It appears you need to change the
homepage
parameter in your configuration file and change few settings with yourrouter
See this as I think it can help https://scottvinkle.me/blogs/work/how-to-deploy-a-react-app-to-a-subdirectory