簡體   English   中英

Heroku上的mongodb驅動程序錯誤:找不到模塊'mongodb-core'

[英]Error with mongodb driver on Heroku: Cannot find module 'mongodb-core'

我正在嘗試將Node.js Express應用程序升級到適用於Mongodb的更新驅動程序。 我的package.json具有“ mongodb”:“ ^ 2.0.40”。 它可以在我的機器上正常運行,並且可以部署到Heroku上(例如,沒有警告/錯誤)。 但是,該應用在使用時崩潰,並顯示以下錯誤:

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

我嘗試過各種版本的mongodb驅動程序,但無濟於事。

如果您使用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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM