我的nodejs API在本地运行良好,并且在travis CI和Heroku上构建良好,但出现应用程序错误。
尝试通过heroku logs --tail
获取错误详细信息,并显示以下错误:
2019-01-30T09:17:26.283351 + 00:00应用程序[api]:由用户darotudeen@gmail.com创建的v28版本 2019-01-30T09:17:29.970742 + 00:00 heroku [web.1]:状态从开始更改为崩溃 2019-01-30T09:17:29.943724 + 00:00 heroku [web.1]:进程退出,状态为1 2019-01-30T09:17:29.000000 + 00:00 app [api]:构建成功 2019-01-30T09:17:35.070405 + 00:00 heroku [router]:at =错误代码= H10 desc =“应用程序崩溃”方法=获取路径=“ /”主机= polityco.herokuapp.com request_id = eefb522c-82f1 -4464-884d-18bcfad43cfd fwd =“ 197.210.29.28” dyno = connect = service = status = 503字节= protocol = https
我多次更改了package.json和Procfile配置,但无济于事。
我的package.json
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "nyc mocha --compilers js:@babel/register server/test/*.spec.js --exit",
"start:dev": "babel-node server/app/app.js",
"start": "node --exec babel-node server/app/app.js",
"heroku": "node server/app/app.js",
"build": "babel server -d lib",
"serve": "node lib/app/app.js",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov"
},
"engines": {
"node": "10.3.0"
},
"author": "darot",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.3",
"dotenv": "^6.2.0",
"express": "^4.16.4",
"morgan": "^1.9.1"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/node": "^7.0.0",
"@babel/preset-env": "^7.3.1",
"@babel/register": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.0.0",
"babel-loader": "^8.0.5",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"chai": "^4.2.0",
"chai-http": "^4.2.1",
"codecov": "^3.1.0",
"coveralls": "^3.0.2",
"eslint": "^5.12.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.15.0",
"istanbul": "^0.4.5",
"mocha": "^5.2.0",
"nodemon": "^1.18.9",
"nyc": "^13.1.0",
"travis": "^0.1.1"
}
}
和我的procfile 网站:npm运行heroku