简体   繁体   中英

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 .

Heroku logs :

在此处输入图片说明

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

Next I was successfully able to deploy my app on Heroku but I am getting the error.My implementation is as follows :

EDIT : I removed the Procfile , compared to shown in following pics ,as I added the "start" key in package.json

Local :

在此处输入图片说明

Directory Structure - /webapp is the root directory : 在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

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 )

Files contents of 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"
      }
    }

package.json in /myRESTApp/server:

{
  "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

将启动脚本更改为node ./myRESTApp/server/server.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM