当我想使用monk作为中间件来访问mongodb时,它会提示
我正在运行的evn如下:
答案 0 :(得分:2)
转到monk index.js文件(yourProjectDirectory/node_modules/monk/node_modules/mongodb/node_modules/bson/ext/index.js
)
应该看起来像
try {
// Load the precompiled win32 binary
if(process.platform == "win32" && process.arch == "x64") {
bson = require('./win32/x64/bson');
} else if(process.platform == "win32" && process.arch == "ia32") {
bson = require('./win32/ia32/bson');
} else {
bson = require('../build/Release/bson');
}
} catch(err) {
// Attempt to load the release bson version
try {
bson = require('../build/Release/bson');
} catch (err) {
console.dir(err)
console.error("js-bson: Failed to load c++ bson extension, using pure JS version");
bson = require('../lib/bson/bson');
}
}
将catch块更改为
try {
...
} catch(err) {
// Attempt to load the release bson version
try {
bson = require('../browser_build/bson');
} catch (err) {
console.dir(err)
console.error("js-bson: Failed to load c++ bson extension, using pure JS version");
bson = require('../lib/bson/bson');
}
}
希望这有帮助
大卫