找不到模块'mongdb“的Heroku mongoskin [英] cannot find module 'mongdb' heroku mongoskin

查看:163
本文介绍了找不到模块'mongdb“的Heroku mongoskin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序正在当地寻找,但部署到Heroku的我的模块之一,当无法找到。我用的.gitignore文件忽略node_modules文件夹,并允许Heroku上安装适当的依赖关系。当我运行 Heroku的开放命令,并使用 Heroku的日志 - 尾搜索日志,它显示了这个错误。

My app is working find locally, but when deploying to heroku one of my modules can't be found. I used a .gitignore file to ignore the node_modules folder and allow heroku to install the proper dependencies. When i run the heroku open command and search the logs using heroku logs --tail it shows this error.

我得到的错误是:

2015-10-21T14:42:58.415140+00:00 app[web.1]: Error: Cannot find module 'mongodb'
2015-10-21T14:42:58.415141+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:336:15)
2015-10-21T14:42:58.415142+00:00 app[web.1]:     at Function.Module._load (module.js:278:25)
2015-10-21T14:42:58.415142+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-10-21T14:42:58.415143+00:00 app[web.1]:     at require (module.js:384:17)
2015-10-21T14:42:58.415144+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/mongoskin/lib/index.js:14:13)
2015-10-21T14:42:58.415145+00:00 app[web.1]:     at Module._compile (module.js:460:26)
2015-10-21T14:42:58.415145+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
2015-10-21T14:42:58.415146+00:00 app[web.1]:     at Module.load (module.js:355:32)
2015-10-21T14:42:58.415146+00:00 app[web.1]:     at Function.Module._load (module.js:310:12)
2015-10-21T14:42:58.415147+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-10-21T14:42:59.337084+00:00 heroku[web.1]: Process exited with status 1
2015-10-21T14:42:59.348953+00:00 heroku[web.1]: State changed from starting to crashed

本地我的应用程序结构如下:

locally my app structure is as follows:

app/
config/
node_modules/
..
-mongodb
-mongoskin
..
public/

当我使用bash的搜索目录的Heroku我没有看到MongoDB的模块。可能是什么问题?

When I search the heroku directory using the bash I don't see the mongodb module. What could be the issue?

推荐答案

我已经想通了答案。我在本地删除的文件node_modules奔着 NPM安装再次和节点显示这样的警告:

I've figured out the answer. I deleted the node_modules files locally and ran npm install again and node showed this warning:

npm WARN peerDependencies The peer dependency mongodb@~2.0 included from mongoskin will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

我必须明确申报的MongoDB的mongoskin依赖于我的package.json文件照片直接mongoskin是这样的:

I had to declare the mongoskin dependency on mongodb explicitly in my package.json file for mongoskin direclty like this:

"dependencies": {
    ...
    "mongoskin": "2.0.3",
    "mongodb": "^2.0.46",
    ...
   }

我把它推到Heroku和它的工作。

I pushed it to heroku and it worked.

这篇关于找不到模块'mongdb“的Heroku mongoskin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆