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

前端 未结 30 2339
予麋鹿
予麋鹿 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:58

    In my case, the bits that come with mongoose (npm install mongoose) have a working version of the mongodb package in its node_modules folder.

    The following steps saved me the work of troubleshooting the issue:

    • npm install mongoose
    • copy node_modules\mongoose\node_modules\mongodb to my root node_modules folder (overwriting any version that came with npm install mongodb)
    • ignore the Failed to load c++ bson extension... error (or change the code to be silent on the issue)

提交回复
热议问题