0

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 :

enter image description here

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 :

enter image description here

Directory Structure - /webapp is the root directory : enter image description here

enter image description here

enter image description here

enter image description here

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

21
  • Try using this path in start script ./myRESTApp/server/server.js. You missed the dot. Commented Jan 3, 2017 at 10:40
  • @AnuragAwasthi you meant in value for key "start" in package.json of root dirdctory ? Commented Jan 3, 2017 at 10:41
  • Having two package.json would do you no good. Only first package.json would be processed (which is in outer folder). Commented Jan 3, 2017 at 10:42
  • @AnuragAwasthi if i will delete inner package.json then to test in my local i need to run nodemon from root directory ? Commented Jan 3, 2017 at 10:43
  • 1
    @Softxide Change start script to node ./myRESTApp/server/server.js. Commented Jan 3, 2017 at 11:27

1 Answer 1

1

Change start script to node ./myRESTApp/server/server.js.

Sign up to request clarification or add additional context in comments.

1 Comment

My rest endpoints are working but i am unable to load my angularjs views

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.