Need help deploying react app to heroku

The above is the output i get after deploying an application to heroku. How do I fix this? Please help!

There could be any number of reasons.

You’d really need to check the logs, and post them here.

1 Like

Hello, I’m really not sure of the type of error to post but this is the overall output link
Kindly assist

You might want to check your code, reference error dist is not defined, maybe you referenced a variable that is not defined

app working fine as expected on my computer, “dist” is part of .gitignore files during commit to github. Maybe I am getting it wrong deploying to heroku repo. I am not sure

That’s likely the problem. Heroku hosts your git folder.

Are you using a React build pack on Heroku? I haven’t deployed React to Heroku before, but have had to use build packs for similar things.

If that doesn’t work, you could deploy your dist folder instead of ignoring it (which is how I host react apps on GH pages).

Did you build the application before pushing ,

You know npm run build or yarn build

My guess is that he did, but Heroku can only see what you push to git, and his build folder is ignored.

You could try running the build on Heroku, but Heroku uses ephemeral storage, so that might not work.

hope you remembered to tell node where your build react folder is like this

and I think I ran into some issues when I missed that part, checkout the app at it a react app


Hold on from your picture above it seems you are trying to deploy a react app without a node back end , I don’t think it would work you need to have a node back end or a back end from any other languages

Oh, good pick up!

If that’s the case, you can use netlify or github pages to deploy without a backend.

Jackson is right , heroku requires you to have a back end but github or netlify would host static pages for you

that sounds like a better option

Can you take a screenshot of your folder structure where you have the build for your react app

The build session is right above…

Just keep going at it , you would eventually figure it out, just ask big brother google

1 Like