我一直在尝试在appname' picbookapp'下部署一个nodejs应用程序。在heroku上有一个mongo数据库。对于mongodb,我使用了mlabs,我已经将mONGO_URI添加到我的heroku app中的配置变量中。我还添加了Procfile文件。但由于某些原因我收到错误。因为我是新手应用程序部署任何类型的帮助将非常感激。这是几个错误日志 开始:未找到 代码ELIFECYCLE, errrno ENOENT,文件sh, 系统调用生成, 产生ENOENT 这是packag.json文件 -
{
"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"
}
}
这是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();