总节点菜鸟在这里。我一直在尝试设置示例节点应用程序,但是每次我尝试运行时都会弹出以下错误:
节点应用
Failed to load c++ bson extension, using pure JS version
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [#$%67890 :27017]
at null.<anonymous> (/home/thejazeto/code/nodejs/authen/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:553:74)
at EventEmitter.emit (events.js:106:17)
at null.<anonymous> (/home/thejazeto/code/nodejs/authen/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
at EventEmitter.emit (events.js:98:17)
at Socket.<anonymous> (/home/thejazeto/code/nodejs/authen/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:512:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:830:16
at process._tickCallback (node.js:415:13)
在Windows 7(x64)上唯一对我有帮助的东西:https : //stackoverflow.com/a/29714359/2670121
用x32版本重新安装node和python。
我花了很多时间解决这个错误:
最后,当我安装模块
node-gyp
(用于构建本机插件),甚至将Windows SDK与Visual Studio一起安装时,nodejs都无法将组装好的模块识别bson.node
为模块。重新安装后,问题消失了。同样,此错误是什么意思?
实际上,这甚至不是错误。您仍然可以使用猫鼬。但是在这种情况下,
bson
您得到的不是代替模块的快速本机实现,而是js-realization
慢了。I saw many tips like: "edit path deep inside node_modules..." - which is totally useless, because it does not solve the problem, but just turned off the error messages.