[英]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.