mongoDB报错Cannot find module '../build/Release/bson'
来源:互联网 发布:查看淘宝店铺数据 编辑:程序博客网 时间:2024/05/17 17:39
分类: nodejs2015-06-14 13:50 251人阅读 评论(0) 收藏 举报
http://blog.csdn.net/xiebaochun/article/details/46490741
打算用nodejs写一个blog系统,发现nodejs还是存在很多的坑。在使用mongodb时遇到如下报错问题:
- { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
- js-bson: Failed to load c++ bson extension, using pure JS version
折腾了一番,最后是这样解决的:
找到 npm 的module mongodb ..node_modules\mongodb\node_modules\bson\ext\index.js
并并在catch块改变bson的js本版路径:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;"><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">bson </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">=</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);"> require</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">(</span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'../build/Release/bson'</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">);</span></code>
变成
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;"><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">bson </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">=</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);"> require</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">(</span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'../browser_build/bson'</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">);</span></code>
如果发现连文件夹browser_biuild都没有的话(我的情况就是这样),直接复制文件:
..node_modules\bson\build\Release\bson
from
..node_modules\bson\browser_build\bson
0 0
- mongoDB报错Cannot find module '../build/Release/bson'
- mongoDB报错Cannot find module '../build/Release/bson'
- mongodb 报错 Error: Cannot find module '../build/Release/bson'解决办法
- nodeJs启动的时候:Error: Cannot find module '../build/Release/bson'的解决办法
- nodeJs启动的时候:Error: Cannot find module '../build/Release/bson'的解决办法
- Error: Cannot find module '../build/Release/canvas'
- nodejs报错:Cannot find module 'ejs'
- Node.js报错cannot find module
- webpack 报错Cannot find module 'opn'
- Cannot find module '../build/Debug/iconv.node
- nodejs express 启动报错:Error: Cannot find module 'xxx'
- 关于新版本react-native报错 :Cannot find module 'invariant'
- vue报错Error: Cannot find module 'ms'
- 安装vue项目启动报错Cannot find module
- 【Gulp】报错Cannot find module 'jshint/src/cli'
- VS2013 Cordova Build Error - cannot find module ./lib/plugin解决办法
- android 导入module,报failed to find build tools 错解决方案
- 用Intellij IDEA创建新项目的时候报错cannot find resource directory for module
- Codeforces #308 C. Vanya and Scales
- C初学者如何从内置基本数据类型进阶到抽象高级数据类型
- 技术论坛 > 详解大数据存储:哪些问题最容易出现
- STL源码剖析(4):容器(vector)
- 静心,征程
- mongoDB报错Cannot find module '../build/Release/bson'
- iOS 项目中用到的一些 iOS 开源库和第三方组件
- 关于后盾网yii框架的学习小结(10)--使用AR类的增删改查
- jQuery开发之动画二
- 传智播客PHP学科进驻上海,给华东IT圈报喜
- android触摸事件流程(一)
- android 去掉顶部状态栏
- jquery计时器timer
- 基于python:opencv简单图片操作