io.js下MongoDB驱动的问题
发布于 6分钟前 作者 WangZishi 7 次浏览 来自 问答

操作系统:Mac OS X 环境:xcode command line tools、io.js 2.2.1、npm 2.11.0

app.js

var express = require('express'),
    cons = require('consolidate'),
    mongodb = require('mongodb');

package.json

{
  "name":"intro_npm",
  "version":"0.0.0",
  "description": "npm introduction",
  "main": "app.js",
  "dependencies": {
    "consolidate": "~0.9.1",
    "express": "~3.2.6",
    "mongodb": "~1.3.10"
  },
  "author": "Shaun Verch",
  "license": "BSD"
}

bash 执行npm install的结果

npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] license should be a valid SPDX license expression
 
> [email protected] install /Users/wangzishi/Test/intro_npm/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o

> [email protected] install /Users/wangzishi/Test/intro_npm/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bson/ext/bson.o
[email protected] node_modules/consolidate

[email protected] node_modules/express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

[email protected] node_modules/mongodb
├── [email protected]
└── [email protected]

看起来安装应该没有问题 但是执行$ iojs app.js的时候控制台输出:

Failed to load c++ bson extension, using pure JS version

为啥bson组建加载失败呢?install的时候也没有warning或者error。 求指教

回到顶部