我疯狂地试图解决这个问题。我有一个使用Express和MongoDB(mongoose)的node.js应用程序。它在当地运行完美。我将它部署到heroku看似没有问题,但是当我尝试实际启动应用程序时它会崩溃。 heroku日志说:
macbook-pro-4:FF_Courtney cmitchell$ heroku logs
2012-10-29T19:31:27+00:00 heroku[web.1]: State changed from crashed to starting
2012-10-29T19:31:30+00:00 heroku[web.1]: Starting process with command `node web.js`
2012-10-29T19:31:31+00:00 app[web.1]:
2012-10-29T19:31:31+00:00 app[web.1]: module.js:340
2012-10-29T19:31:31+00:00 app[web.1]: throw err;
2012-10-29T19:31:31+00:00 app[web.1]: Error: Cannot find module './http'
2012-10-29T19:31:31+00:00 app[web.1]: ^
2012-10-29T19:31:31+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:338:15)
2012-10-29T19:31:31+00:00 app[web.1]: at Function.Module._load (module.js:280:25)
2012-10-29T19:31:31+00:00 app[web.1]: at Module.require (module.js:362:17)
2012-10-29T19:31:31+00:00 app[web.1]: at require (module.js:378:17)
2012-10-29T19:31:31+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/express/node_modules/connect/lib/connect.js:13:18)
2012-10-29T19:31:31+00:00 app[web.1]: at Module._compile (module.js:449:26)
2012-10-29T19:31:31+00:00 app[web.1]: at Object.Module._extensions..js (module.js:467:10)
2012-10-29T19:31:31+00:00 app[web.1]: at Module.load (module.js:356:32)
2012-10-29T19:31:31+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2012-10-29T19:31:31+00:00 app[web.1]: at Module.require (module.js:362:17)
2012-10-29T19:31:32+00:00 heroku[web.1]: Process exited with status 1
我有一个带有依赖项的package.json文件:
{
"name": "favorite-failure",
"version": "0.0.1",
"dependencies": {
"express": "2.5.6",
"ejs" : "latest",
"mongoose" : "3.3.1",
"request" : "2.11.4",
"moment" : "1.7.2",
"mongodb" : "0.9.6-7",
"connect-mongodb": ">= 1.1.3"
},
"engines": {
"node": ">= 0.8.12",
"npm": ">= 1.1.49"
}
}
我对此有点新意,所以任何帮助都会非常感激。谢谢!