skip to Main Content

Goal: I have created the start of a React project and wish to test it on my server (hosted by goDaddy, uploading via cPanel). My app works fine in Development Mode.

Question: I have ran npm build which has created a build folder, but what files am I supposed to upload to my server? I tried putting the entire contents of the build folder on, but it still says the site is not launched. Is this because there is no index.html file generated? Currently my build folder contains: assets.json, LICENSE.txt, package.json, server.js, yarn.lock, chunks/ and public/. Is there supposed to be an html file generated? Or should these files be sufficient to deploy the website given that it works in development mode?

Thanks for bearing with me, this is the first time I have tried to deploy a React App and likely have several fundamental misunderstandings of how it works. Also if anyone is willing to chat for several minutes so I can ask a few questions about my project and react let me know – much appreciated!

2

Answers


  1. Your answer is much more simple than appears: Just run npm run build, then just upload that whole folder to your GODADDY server. Importantly, you must place your index.html (or app-name.html) directly on the / public path defined by your URL’s DNS. So, Top-level has your single entry point index.html that points to folder build/ to get your xyx.main.js and the xyz.main.css …
    and that’s it! easy as pie

    Login or Signup to reply.
  2. Hello

    Dear,
    If you can try to change your package.json file and add (“homepage”: “http://yourDomain/“,) like this

     "version": "0.1.0",
      "homepage": "yourDominUrl",
    

    Like

      "homepage": "http://yourDomain/",
    

    and

    build again

    npm run build
    

    and the build folder is only should be uploaded file

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search