Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I deploy react.js web app to a share hosting?

Tags:

reactjs

I am wondering if it is possible to deploy react.js web app that I've built to a share hosting site that does not have node.js installed?

I use webpack to build the application and it creates normal html, js, css file. I uploaded the static folder that includes all those html, js(bundle.js) and css files, but when I request the site, the server reply with 404 bundle.js not found response.

like image 480
Zip Avatar asked Mar 10 '17 18:03

Zip


People also ask

Can we deploy Mern app on shared hosting?

I had the same query and the only solution that I could find was that it is not possible to deploy your MERN app on shared hosting and you need a dedicated server for your applications.


1 Answers

Yes you sure can put react on a shared hosting provider.

Seeing as you're getting a 404 error (not found), you are probably referencing your react file/bundle incorrectly. It might not even be named bundle.js if you're using a boilerplate to create your application.

Can you give more information? What does your index.html file look like? What does your directory structure look like? If you are able to post these files I can tell you what the issue is.

Update: The answer below should be accepted. (Although this would assume that you have the ability to make a build which you have not verified or not.)

Make a build using the build command through whatever boilerplate you used. Deploy those files on your shared hosting server. Make sure that index.html is at the root of where your server is expecting the root to be and your app should be live.

like image 198
daHolby Avatar answered Sep 29 '22 05:09

daHolby