[英]Heroku giving H10 error with npx create-react-app
I am creating a react app using npx create-react-app, however, no matter what I do, heroku gives me an H10 error back.我正在使用 npx create-react-app 创建一个反应应用程序,但是,无论我做什么,heroku 都会给我一个 H10 错误。 Is there a way to get a more detailed error message?
有没有办法获得更详细的错误信息? And how do I get the app up and running?
以及如何让应用程序启动并运行? Here is my package.json file.
这是我的 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"
}
}
And this is my Procfile这是我的 Procfile
web:npm start
Edit 1:编辑1:
I tried running heroku restart
and installing https://github.com/mars/create-react-app-buildpack.git buildpack.我尝试运行
heroku restart
并安装https://github.com/mars/create-react-app-buildpack.git buildpack。
Edit 2: This is the error message I get:编辑 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]: > portfolio@0.1.0 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
Try changing the version of React in package.json.尝试更改 package.json 中的 React 版本。 I changed react version to 16.12.0, react-dom to 16.12.0, react-router-dom to 5.1.2 and react scripts to 3.2.0.. It worked fine afterwards.
我将 react 版本更改为 16.12.0,react-dom 更改为 16.12.0,react-router-dom 更改为 5.1.2 并将脚本更改为 3.2.0 .. 之后它运行良好。 Another option is to change create react app webpack config in heroku settings.
另一种选择是在 heroku 设置中更改创建反应应用程序 webpack 配置。
You can get a detailed error log by first installing heroku cli globally: herokudownloadlink您可以通过首先全局安装 heroku cli 来获取详细的错误日志: herokudownloadlink
then use your command line to login into heroku:然后使用您的命令行登录到 heroku:
heroku login
after providing your credentials.提供您的凭据后。 do:
做:
heroku logs -tail -a <your application name>
You will now see a detailed log of what happened.您现在将看到发生的事情的详细日志。 A H10 error usually means the process ended with an error.
H10 错误通常意味着流程以错误结束。 It could be because maybe heroku could not bind to a port.
可能是因为 heroku 无法绑定到端口。
Also in your package.json change "DONTEXECUTEbuild" to "build".同样在您的 package.json 中将“DONTEXECUTEbuild”更改为“build”。 heroku needs to build sometimes for optimal performance.
heroku 有时需要构建以获得最佳性能。
I forgot to do git push heroku master
after installing buildpack.安装 buildpack 后,我忘了做
git push heroku master
。 Its working now.它现在工作。
I had same issue, after a lot of struggles it worked after downgrading react-scripts to 3.1.2 in package.json (before this I had same version as you)我遇到了同样的问题,经过大量的努力,在 package.json 中将 react-scripts 降级到 3.1.2 后它起作用了(在此之前我和你有相同的版本)
"react-scripts": "3.1.2" “反应脚本”:“3.1.2”
also removed node modules and then re-run npm install还删除了节点模块,然后重新运行 npm 安装
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.