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

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

    If you are using windows 8.1, you might want to make sure that you are installing your npm modules with the correct visual studio compiler.

    I have Visual Studio 2012 installed, this command works for me. (after deleting node_modules dir)

    npm install --msvs_version=2012

    For some reason, node-gyp is trying to use the incorrect version of Visual Studio compiler. I also noticed that the "npm install" command was printing out a warnings about not node-gyp dependencies when installing the mongodb and mongoose modules.

    After using the correct msvs_version, the npm install warnings went away as well as the console warning when running my nodejs app.

    You might also want to make sure that you have the correct Python 2.7.X version installed and not Python 3.0.X.

    You will also need to make sure that python is in your env path.

提交回复
热议问题