General Question: When using create-react-app, and running npm run build, do I only need to upload the "build" folder as a manual deploy?

Hello,

I have a general question. I have a react app that runs really well locally, but it seems to have issues (particularly around routing) when it’s deployed to netlify. Like, some routed paths give a 404 error only when deployed on netlify, etc.

The wide variety of errors on netlify but not locally make me think I’m perhaps not deploying properly. To do a manual deploy, here are my steps:

  1. test the app locally
  2. stop the local instance
  3. run “npm run build”
  4. run “netlify deploy” and when prompted for the deploy folder, type “build”
  5. go to netlify and check the deploy and then choose “publish deploy”

Is that it? The site seems to be deploying well, but I’m having just weird issues that don’t show up locally. Is there anything else I need to do? Anything on netlify’s side to set it up for a react app, or run some kind of install on the netlify servers somehow, or anything?

Any guidance on the proper way to deploy would be appreciated. Thanks!

Yeah that’s all that you need to do. To fix the 404 caused by React, you need to do this (second redirect in that post):

Hi, that was the issue—thanks!

I can navigate my website by entering the path routes, and fix broken links error by creating a file _redirects without a file extension to the public directory. inside the _redirects is the code below
/* /index.html 200

1 Like

Nice @Aladdin thanks so much for sharing this with the community.

thanks alot @Aladdin. It worked for me.
i just wanted to ask how is it working ? what this code does written in _redirects?

1 Like

_redirects helps in telling netlify the index.html is the home route

1 Like