Heroku使用npx create-react-app给出H10错误

问题描述 投票:0回答:3

我正在使用npx create-react-app创建一个react应用,但是,不管我做什么,heroku都会给我H10错误。有没有办法获得更详细的错误消息?以及如何启动和运行该应用程序?这是我的package.json文件。

{
  "name": "portfolio",
  "version": "0.1.0",
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "DONTEXECUTEbuild": "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"
    ]
  },
  "engines": {
    "node": "12.16.1"
  }
}

这是我的Procfile

web:npm start

编辑1:

我尝试运行heroku restart并安装https://github.com/mars/create-react-app-buildpack.git buildpack。

编辑2:这是我收到的错误消息:

2020-04-12T10:12:16.885382+00:00 heroku[web.1]: State changed from crashed to starting
2020-04-12T10:12:27.041455+00:00 app[web.1]:
2020-04-12T10:12:27.041478+00:00 app[web.1]: > [email protected] start /app
2020-04-12T10:12:27.041478+00:00 app[web.1]: > react-scripts start
2020-04-12T10:12:27.041478+00:00 app[web.1]:
2020-04-12T10:12:29.005933+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.18.174.102/
2020-04-12T10:12:29.006390+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-04-12T10:12:29.006491+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-04-12T10:12:29.006574+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-04-12T10:12:29.006803+00:00 app[web.1]: Starting the development server...
2020-04-12T10:12:29.006804+00:00 app[web.1]:
2020-04-12T10:12:29.112722+00:00 heroku[web.1]: State changed from starting to crashed
javascript reactjs heroku deployment web-deployment
3个回答
1
投票

您可以通过首先全局安装heroku cli来获得详细的错误日志:herokudownloadlink

然后使用您的命令行登录到heroku:

heroku login

提供您的凭据后。做:

heroku logs -tail -a <your application name>

您现在将看到发生了什么的详细日志。 H10错误通常表示该过程以错误结束。这可能是因为heroku可能无法绑定到端口。

同样也在您的package.json中将“ DONTEXECUTEbuild”更改为“ build”。 heroku有时需要构建以获得最佳性能。


0
投票

我在安装buildpack后忘记做git push heroku master。它现在正在工作。


0
投票

我遇到了同样的问题,经过大量的努力之后,在将package.json中的react-scripts降级到3.1.2之后,它仍然有效(在此之前,我的版本与您相同)

“反应脚本”:“ 3.1.2”

还删除了节点模块,然后重新运行npm install

© www.soinside.com 2019 - 2024. All rights reserved.