当我使用Heroku部署角度应用程序时出现应用程序错误

时间:2018-07-05 08:25:20

标签: node.js angular heroku

我已经成功将我的angular6应用程序部署到了heroku,但是不幸的是,我收到了“该应用程序中发生错误,该页面无法提供”的页面。

这里的package.json代码示例:

  "scripts": {
"ng": "ng",
"conventional-changelog": "conventional-changelog",
"start": "node server.js",
"build": "ng build",
"build:prod": "npm run build",
"test": "ng test",
"test:coverage": "rimraf coverage && npm run test -- --code-coverage",
"lint": "ng lint",
"lint:fix": "ng lint ngx-admin-demo --fix",
"lint:styles": "stylelint ./src/**/*.scss",
"lint:ci": "npm run lint && npm run lint:styles",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "ng e2e",
"docs": "compodoc -p src/tsconfig.app.json -d docs",
"docs:serve": "compodoc -p src/tsconfig.app.json -d docs -s",
"prepush": "npm run lint:ci",
"release:changelog": "npm run conventional-changelog -- -p angular -i CHANGELOG.md -s",
"postinstall": "ng build --aot -prod"

},

当我使用npm start在本地运行该应用程序时,它运行正常。

我的package.json文件

{   “ name”:“ danoram-angular-quickstart”,   “ version”:“ 1.0.0”,   “脚本”:{     “ start”:“ npm run lite”,     “ lite”:“ lite-server”   },   “ license”:“ MIT”,   “依赖关系”:{     “ @ angular / common”:“〜2.3.0”,     “ @ angular / compiler”:“〜2.3.0”,     “ @ angular / core”:“〜2.3.0”,     “ @ angular / forms”:“〜2.3.0”,     “ @ angular / http”:“〜2.3.0”,     “ @ angular / platform-b​​rowser”:“〜2.3.0”,     “ @ angular / platform-b​​rowser-dynamic”:“〜2.3.0”,     “ @ angular / router”:“〜3.3.0”,     “ @ angular / upgrade”:“〜2.3.0”,     “ angular-in-memory-web-api”:“〜0.1.16”,     “ core-js”:“ ^ 2.4.1”,     “ reflect-metadata”:“ ^ 0.1.8”,     “ rxjs”:“ 5.0.0-rc.4”,     “ zone.js”:“ ^ 0.7.2”   },   “ devDependencies”:{     “ concurrently”:“ ^ 3.0.0”,     “ lite-server”:“ ^ 2.2.2”,     “ webpack”:“ ^ 1.14.0”   } }

我的server.js文件:

const express = require('express');
const app = express();
app.use(express.static(path.join(__dirname, 'dist')));
app.listen(process.env.PORT || 8000);

heroku日志:

2018-07-05T07:57:10.809919 + 00:00 app [web.1]:位于Module.load(module.js:565:32) 2018-07-05T07:57:10.809921 + 00:00 app [web.1]:在tryModuleLoad(module.js:505:12) 2018-07-05T07:57:10.809922 + 00:00 app [web.1]:位于Function.Module._load(module.js:497:3) 2018-07-05T07:57:10.809923 + 00:00 app [web.1]:位于Function.Module.runMain(module.js:693:10) 2018-07-05T07:57:10.809925 + 00:00 app [web.1]:在启动时(bootstrap_node.js:191:16) 2018-07-05T07:57:10.809927 + 00:00 app [web.1]:在bootstrap_node.js:612:3 2018-07-05T07:57:11.005204 + 00:00 heroku [web.1]:状态从开始更改为崩溃 2018-07-05T07:57:10.987769 + 00:00 heroku [web.1]:进程退出,状态为1 2018-07-05T07:57:12.647973 + 00:00 heroku [router]:at =错误代码= H10 desc =“应用程序崩溃”方法= GET路径=“ /” host = cchain-redlean.herokuapp.com request_id = c9d781b1 -89df-4b38-bd60-b81699303c1b fwd =“ 196.203.248.245” dyno = connect = service = status = 503字节=协议= https 2018-07-05T07:57:13.158493 + 00:00 heroku [router]:at =错误代码= H10 desc =“应用程序崩溃”方法= GET路径=“ / favicon.ico”主机= cchain-redlean.herokuapp.com request_id = 39b5588c-29b0-47b9-bacd-e93838e9ae16 fwd =“ 196.203.248.245” dyno = connect = service = status = 503字节= protocol = https

enter image description here

感谢所有帮助!

这里提到的问题是:enter link description here

0 个答案:

没有答案