0

I have been trying to deploy a nodejs app under appname 'picbookapp' on heroku which has a mongo database.For mongodb I have used mlabs and I have added MONGO_URI to the config vars in my heroku app.I have also added the Procfile file.But for some reasons I am getting errors.Since I am new to app deployment any kind of help would be highly appreciated.Here are the few error logs start: not found code ELIFECYCLE, errrno ENOENT,file sh, syscall spawn, spawn ENOENT Here is the packag.json file--

{
  "name": "gridfsandmulter",
  "version": "1.0.0",
  "private": true,
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
  "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Harshit",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.17.2",
    "bootstrap": "^3.3.7",
    "connect-flash": "^0.1.1",
    "cookie-parser": "^1.4.3",
    "ejs": "^2.5.7",
    "express": "^4.15.3",
    "express-session": "^1.15.4",
    "gridfs-stream": "^1.1.1",
    "hbs": "^4.0.1",
    "mongod": "^2.0.0",
    "mongodb": "^2.2.30",
    "mongoose": "^4.11.4",
    "multer": "^1.3.0",
    "passport": "^0.3.2",
    "passport-local": "^1.0.0"
  },
  "engines": {
    "node": "4.1.1",
    "npm": "5.0.3"
  }
}

Here is the database.js

/**
 * Created by harshitbisht96 on 30/7/17.
 */
var mongodb=require('mongodb');
var MongoClient=mongodb.MongoClient;
var url=process.env.MONGOLAB_URI||'mongodb://localhost:27017/imageDatabase';

function getDb(){
     return MongoClient.connect(url).then(function (db) {
        // console.log(MongoClient.connect(url));
        return db;
    })
}




module.exports=getDb();
Harshit Bisht
  • 65
  • 2
  • 10
  • 1
    Have you installed the heroku command line tools? What is `start`? Do you mean to use `node start.js` ? – Joe Aug 11 '17 at 10:16
  • Yes I have installed heroku command line tools.My bad it has to be "start":"node server.js".I edited that and tried again but still same errors. – Harshit Bisht Aug 11 '17 at 10:38
  • Is it the exact same error? The errors in that screenshot are complaining that start isn't found so if it's the same error then that can't have fixed it. – Joe Aug 11 '17 at 10:40
  • 1
    Yes.Let me share the new screenshot – Harshit Bisht Aug 11 '17 at 10:47
  • I think your question is not complete. But you can check the build logs on your Heroku dashboard. It will provide you with probable causes – Rowland Aug 11 '17 at 11:37
  • It is working now.Thanks for help.It was only the "start" thing which I wrote wrong initially and a syntax error.Thanks for all help. – Harshit Bisht Aug 11 '17 at 12:06

0 Answers0