Node.js Heroku上的mongodb驱动程序出错:找不到模块';mongodb核心&x27;

Node.js Heroku上的mongodb驱动程序出错:找不到模块';mongodb核心&x27;,node.js,mongodb,heroku,Node.js,Mongodb,Heroku,我正在尝试将Node.js Express应用程序升级到Mongodb的更新驱动程序。My package.json有“mongodb”:“^2.0.40”。它在我的机器上运行良好,我能够部署到Heroku fine(如中所示,没有警告/错误)。但是,应用程序在使用时崩溃,出现以下错误: 2015-09-14T13:03:52.225525+00:00 heroku[web.1]: Starting process with command `node app.js` 2015-09-14T13

我正在尝试将Node.js Express应用程序升级到Mongodb的更新驱动程序。My package.json有“mongodb”:“^2.0.40”。它在我的机器上运行良好,我能够部署到Heroku fine(如中所示,没有警告/错误)。但是,应用程序在使用时崩溃,出现以下错误:

2015-09-14T13:03:52.225525+00:00 heroku[web.1]: Starting process with command `node app.js`
2015-09-14T13:03:52.271972+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-09-14T13:03:54.315461+00:00 heroku[web.1]: Process exited with status 143
2015-09-14T13:03:54.701499+00:00 app[web.1]: module.js:338
2015-09-14T13:03:54.701522+00:00 app[web.1]:     throw err;
2015-09-14T13:03:54.701523+00:00 app[web.1]:           ^
2015-09-14T13:03:54.701525+00:00 app[web.1]: Error: Cannot find module 'mongodb-core'
2015-09-14T13:03:54.701526+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:336:15)
2015-09-14T13:03:54.701527+00:00 app[web.1]:     at Function.Module._load (module.js:278:25)
2015-09-14T13:03:54.701529+00:00 app[web.1]:     at require (module.js:384:17)
2015-09-14T13:03:54.701528+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-09-14T13:03:54.701531+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/mongodb/index.js:2:12)
2015-09-14T13:03:54.701532+00:00 app[web.1]:     at Module._compile (module.js:460:26)
2015-09-14T13:03:54.701533+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
2015-09-14T13:03:54.701534+00:00 app[web.1]:     at Module.load (module.js:355:32)
2015-09-14T13:03:54.701535+00:00 app[web.1]:     at Function.Module._load (module.js:310:12)
2015-09-14T13:03:54.701536+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-09-14T13:03:55.561071+00:00 heroku[web.1]: State changed from starting to crashed
2015-09-14T13:03:55.548974+00:00 heroku[web.1]: Process exited with status 1
2015-09-14T13:03:52.225525+00:00Heroku[web.1]:使用命令'node app.js启动进程`
2015-09-14T13:03:52.271972+00:00 heroku[web.1]:停止使用SIGTERM的所有进程
2015-09-14T13:03:54.315461+00:00 heroku[web.1]:进程已退出,状态为143
2015-09-14T13:03:54.701499+00:00应用程序[网站1]:module.js:338
2015-09-14T13:03:54.701522+00:00应用程序[web.1]:抛出错误;
2015-09-14T13:03:54.701523+00:00应用程序[网站1]:^
2015-09-14T13:03:54.701525+00:00应用程序[web.1]:错误:找不到模块“mongodb core”
2015-09-14T13:03:54.701526+00:00应用程序[web.1]:位于Function.Module.\u resolveFilename(Module.js:336:15)
2015-09-14T13:03:54.701527+00:00应用程序[web.1]:at功能模块加载(模块js:278:25)
2015-09-14T13:03:54.701529+00:00应用程序[web.1]:根据需要(模块js:384:17)
2015-09-14T13:03:54.701528+00:00应用程序[web.1]:位于Module.require(Module.js:365:17)
2015-09-14T13:03:54.701531+00:00应用程序[web.1]:at对象。(/app/node_modules/mongodb/index.js:2:12)
2015-09-14T13:03:54.701532+00:00应用程序[web.1]:at模块编译(模块js:460:26)
2015-09-14T13:03:54.701533+00:00应用程序[web.1]:at Object.Module.\u extensions..js(Module.js:478:10)
2015-09-14T13:03:54.701534+00:00应用程序[web.1]:at Module.load(Module.js:355:32)
2015-09-14T13:03:54.701535+00:00应用程序[web.1]:at功能模块加载(模块js:310:12)
2015-09-14T13:03:54.701536+00:00应用程序[web.1]:位于Module.require(Module.js:365:17)
2015-09-14T13:03:55.561071+00:00 heroku[web.1]:状态从开始更改为崩溃
2015-09-14T13:03:55.548974+00:00 heroku[web.1]:进程已退出,状态为1

我尝试了各种版本的mongodb驱动程序,但都没有成功。

如果您使用mongodb核心,您应该在package.json中指定它,如下所示:

   "dependencies": {
    "express": "~4.9.x"
    , "pg": "~4.4.x"
    , "mongodb": "2.0.14"
    , "mongodb-core": "~1.0"
  },
将其推送到git后,检查日志:

remote: -----> Build succeeded!
remote:        ├── express@4.9.8
remote:        ├── mongodb@2.0.14
remote:        ├── mongodb-core@1.0.5
remote:        └── pg@4.4.1

如果使用mongodb core,应在package.json中指定它,如下所示:

   "dependencies": {
    "express": "~4.9.x"
    , "pg": "~4.4.x"
    , "mongodb": "2.0.14"
    , "mongodb-core": "~1.0"
  },
将其推送到git后,检查日志:

remote: -----> Build succeeded!
remote:        ├── express@4.9.8
remote:        ├── mongodb@2.0.14
remote:        ├── mongodb-core@1.0.5
remote:        └── pg@4.4.1

您介意填充package.json的“依赖项”部分吗?和“远程:-->生成成功!”从输出?。您介意填充package.json“dependencies”部分吗?和“远程:-->生成成功!”从输出?。。