0

I've created a react app using create-react-app.It is working well in my local server.But when I tried to deploy it to heroku it is crashing.I don't know why it is crashing.

In heroku logs --tail its showing error code=H10 desc=App crashed.I searched about this issue and nothing helpful for me.

My question is similar to this question : React app runs locally, crashes when on Heroku error code=H10

But I'm unable to understand the solution they given.

My package.json file is as follows:

{
  "name": "lets-chat",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.28",
    "@fortawesome/free-brands-svg-icons": "^5.13.0",
    "@fortawesome/free-regular-svg-icons": "^5.13.0",
    "@fortawesome/free-solid-svg-icons": "^5.13.0",
    "@fortawesome/react-fontawesome": "^0.1.9",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "dotenv": "^8.2.0",
    "firebase": "^7.14.0",
    "moment": "^2.24.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

I don't know what's wrong in this file.Should I make any changes in this file to get my problem solved?

heroku logs --tail gave the report as follows: enter image description here

3 Answers 3

1

Check out this link (in case none of the solutions from that other post helped your case): https://dev.to/webdevraj/deploy-a-react-app-on-heroku-the-right-way-5efo Pay attention to #6 where they mention the buildpack.

Sign up to request clarification or add additional context in comments.

Comments

1

When using create-react-app and deploying to

  1. dont delete the favicon.ico and manifest.json

  2. also in package.json above scripts insert "engines": { "npm": "6.x", "node": "12.x" },

//NOTE CHECK YOUR NODE AND NPM VERSIONS BY TYPING npm -v and node -v for accurate versions//

  1. In heroku after heroku create command, go to heroku and change buildback under settings to https://github.com/mars/create-react-app-buildpack

Dont add other scripts or change the start, build scripts!

This should clear all h10 errors when deploying to heroku, if they dont i suggest you create a new directory and copy your files there and start over, this link is a great guide to deploy

https://dev.to/smithmanny/deploy-your-react-app-to-heroku-2b6f

Comments

0

I also had same issue. I could figure out it is something to do with react version. I changed the version and it worked. Update your version in package.json and see if it works.

"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.