Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version

前端 未结 30 2164
予麋鹿
予麋鹿 2020-11-28 02:19

I am getting the below error:

{ [Error: Cannot find module \'../build/Release/bson\'] code: \'MODULE_NOT_FOUND\' } 
  js-bson: Failed to load c++ bson extens         


        
相关标签:
30条回答
  • 2020-11-28 02:47

    I also had the same problem with bson.

    trying a newer mongoose version

    npm install mongoose@4.4
    

    solved the issue.

    Massimo.

    0 讨论(0)
  • 2020-11-28 02:48

    The best solution for me was to upgrade from node-mongodb 1.x to 2.x.

    0 讨论(0)
  • 2020-11-28 02:48

    I had the same issue after upgrade version of ubuntu to 16.04. I solved in this way, hope it helps.

    $rm -rf node_modules
    $npm --save install bson
    $npm --save install mongoose
    $npm install
    
    0 讨论(0)
  • 2020-11-28 02:49

    The only thing which helps me on Windows 7 (x64): https://stackoverflow.com/a/29714359/2670121

    Reinstall node and python with x32 versions.
    I spent many time with this error (Failed to load c++ bson extension) and finally, when I installed module node-gyp (for build native addons) and even installed windows SDK with visual studio - nodejs didn't recognize assembled module bson.node as module. After reinstall the problem is gone.

    Again, What means this error?

    Actually, it's even not error. You still can use mongoose. But in this case, instead of fast native realization of bson module, you got js-realization, which slower. I saw many tips like: "edit path deep inside node_modules..." - which totaly useless because it's not solve the problem but just turned off the error messages.

    0 讨论(0)
  • Run this command to uninstall mongoose npm uninstall --save mongoose - thereafter reinstall it but this time npm automatically installs the latest version of mongoose run npm install --save mongoose This worked for me.

    0 讨论(0)
  • 2020-11-28 02:51

    I resolved this issue by installing mogoose version 3.8.23

    npm install mongoose@3.8.23
    
    0 讨论(0)
提交回复
热议问题