[英]Unable to deploy REST based Node.js APP on heroku
I build a Node.js REST implementation using this tutorial .And now i am having problems deploying it on heoroku , local works fine . 我使用本教程构建了一个Node.js REST实现。现在我在将其部署到heoroku时遇到了问题,本地工作正常。
Heroku logs : Heroku日志:
I believe the problem is with my directory structure.
我相信问题出在我的目录结构上。 The "main" key of package.json and and the rest endpoints in index.js are not right
package.json的“主”键和index.js中的其余端点不正确
Next I was successfully able to deploy my app on Heroku but I am getting the error.My implementation is as follows : 接下来,我能够在Heroku上成功部署我的应用程序,但出现错误。我的实现如下:
EDIT : I removed the Procfile , compared to shown in following pics ,as I added the "start" key in package.json
编辑:与下图所示相比,我删除了Procfile,因为我在package.json中添加了“开始”键
Local : 本地:
Directory Structure - /webapp is the root directory : 目录结构-/ webapp是根目录:
I have package.json file at root directory and /server with different version (about which i am not sure how they should be actually for my ngClient and heroku confiurations )
我在根目录和/ server具有不同版本的package.json文件(关于该文件我不确定ngClient和heroku配置的实际用途)
Files contents of root , /webapp : package.json 根目录/ 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"
}
}
package.json in /myRESTApp/server: / 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"
}
}
Node version : 6.9.2 NPM Version : 3.10.9
节点版本:6.9.2 NPM版本:3.10.9
将启动脚本更改为node ./myRESTApp/server/server.js
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.