【发布时间】:2020-08-09 08:12:23
【问题描述】:
我正在使用 nodejs + reactjs + express + mongodb
在另一台服务器上部署了我的后端,它的工作非常好。
但是当我访问前端时,它显示“H10”错误,当我使用
heroku local 它工作得非常好。
我的 package.json
{
"name": "ecommerce",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"braintree-web-drop-in-react": "^1.1.1",
"concurrently": "^5.2.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"react-stripe-checkout": "^2.6.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"heroku-postbuild": "npm run build"
},
"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": "10.x",
"npm": "6.x"
}
}
我得到的日志:
2020-04-25T18:04:45.413902+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ecommerce-frontend-dweep.herokuapp.com request_id=0d7f7627-3a3e-4a79-8221-b09f89fb49d0 fwd="103.240.77.140" dyno= connect= service= status=503 bytes= protocol=https
2020-04-25T18:04:46.267420+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ecommerce-frontend-dweep.herokuapp.com request_id=30e4c07f-fd30-4210-8158-dabbd7d196f9 fwd="103.240.77.140" dyno= connect= service= status=503 bytes= protocol=https
同时运行heroku run node console
输出(如果需要):
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/app/console'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
已经尝试过First Heroku deploy failed `error code=H10`的解决方案,但没有成功
【问题讨论】:
-
已解决:如果有人遇到同样的错误,请尝试以下步骤dev.to/webdevraj/…
标签: node.js reactjs mongodb express heroku