[英]Unable to deploy REST based Node.js APP on heroku
我使用本教程構建了一個Node.js REST實現。現在我在將其部署到heoroku時遇到了問題,本地工作正常。
Heroku日志:
我相信問題出在我的目錄結構上。 package.json的“主”鍵和index.js中的其余端點不正確
接下來,我能夠在Heroku上成功部署我的應用程序,但出現錯誤。我的實現如下:
編輯:與下圖所示相比,我刪除了Procfile,因為我在package.json中添加了“開始”鍵
本地:
我在根目錄和/ server具有不同版本的package.json文件(關於該文件我不確定ngClient和heroku配置的實際用途)
根目錄/ webapp的文件內容:package.json
{
"name": "web_first_package",
"version": "0.0.0",
"description": "first node package for project storm",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start":"/myRESTApp/server/server.js"
},
"engines": {
"node": "6.9.x",
"npm": "3.10.x"
},
"author": "Divyanshu Jimmy",
"license": "ISC",
"dependencies": {
"body-parser": "^1.15.2",
"express": "^4.14.0",
"jwt-simple": "^0.5.1",
"morgan": "^1.7.0"
}
}
/ myRESTApp / server中的package.json:
{
"name": "web_first_package",
"version": "0.0.0",
"description": "first node package for project storm",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"engines": {
"node": "6.9.x",
"npm": "3.10.x"
},
"author": "Divyanshu Jimmy",
"license": "ISC",
"dependencies": {
"body-parser": "^1.15.2",
"express": "^4.14.0",
"jwt-simple": "^0.5.1",
"morgan": "^1.7.0"
}
}
節點版本:6.9.2 NPM版本:3.10.9
將啟動腳本更改為node ./myRESTApp/server/server.js
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.