无法在heroku上部署基于REST的Node.js APP

时间:2017-01-03 10:30:59

标签: angularjs json node.js rest heroku

我使用这个tutorial构建一个Node.js REST实现。现在我在heoroku上部署它时遇到了问题,本地工作正常。

Heroku日志:

enter image description here

  

我认为问题在于我的目录结构。 “主要”键   package.json和index.js中的其余端点不正确

接下来,我成功地在 Heroku 上部署了我的应用,但是我收到了错误。我的实现如下:

  

编辑:我删除了Procfile,与以下图片中显示的相比,因为我在package.json中添加了“start”键

本地:

enter image description here

目录结构 - / webapp是根目录: enter image description here

enter image description here

enter image description here

enter image description here

  

我在根目录和/服务器上有不同的package.json文件   版本(我不知道他们应该如何实际为我的    ngClient 和heroku confiurations)

root,/ 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

1 个答案:

答案 0 :(得分:1)

将开始脚本更改为node ./myRESTApp/server/server.js