【发布时间】:2019-01-21 08:18:50
【问题描述】:
在成功部署我的应用后,我点击了“打开应用”,我看到了这个错误:
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
链接错误https://fcrg.herokuapp.com/
但它确实可以在本地主机中使用 yarn dev cli 正常工作
后端应用的package.json:
{
"name": "site-web-france",
"version": "1.0.0",
"scripts": {
"start": "node server.js",
"heroku-postbuild": "cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build",
"client": "cd client && yarn start",
"server": "nodemon server.js",
"dev": "concurrently --kill-others-on-fail \"yarn server\" \"yarn client\"",
"dev:server": "cd client && yarn build && cd .. && yarn start",
"start": "node server.js",
"heroku-postbuild": "cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build"
},
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.3",
"mongodb": "^3.1.1",
"mongoose": "^5.2.6",
"react-scripts": "^1.1.4"
},
"devDependencies": {
"concurrently": "^3.5.0"
}
}
我认为这个问题是因为“纱线”,你怎么看?
【问题讨论】:
-
您是否尝试过运行 $ heroku local 以进行本地测试。因为如果在部署之前在本地运行它,您会得到更清晰的错误消息。这是链接devcenter.heroku.com/articles/heroku-local
-
我没有heroku cli,暂时没有
-
如果可能的话你应该尝试安装herokucli并在本地测试它,否则很难找出问题。
-
@crg 你找到解决这个问题的方法了吗?我得到了同样的错误
-
我对 node.js + ExpressJS 应用程序有同样的问题。我尝试根据第一个@sedar 评论在本地测试应用程序,起初,它无法正常工作,因为我没有安装依赖项,在运行 npm i 并重新运行本地测试命令后,它在本地工作正常但在网上我得到(无法得到/)错误
标签: node.js reactjs heroku npm yarnpkg