Mac Os X 上的节点 js couchbase 计数器函数绑定问题

Node js couchbase counter function binding issue on Mac Os X

我正在尝试使用 Node.js 和 couchbase 做一些事情,并且我正在使用来自 here 的 SDK。

但是,我遇到了 运行 在存储桶上使用 'counter' 方法的问题。 我正在 运行ning Mac Os X 10.9.5 并使用 couchbase v2.0.5

这是我的测试程序:

var couchbase = require('couchbase');
var connection = new couchbase.Cluster('couchbase://myhostname'); 
var bucket = connection.openBucket();

bucket.counter('test', 1, {initial:1}, function(err, res) {
    console.log(err);
    console.log(res);
});

当我想要 运行 这个时,我遇到了绑定问题,所以看起来:

dyld: lazy symbol binding failed: Symbol not found: _ntohll
    Referenced from: <somepath>/node_modules/couchbase/build/Release/couchbase_impl.node
    Expected in: dynamic lookup

dyld: Symbol not found: _ntohll
    Referenced from: <somepath>/node_modules/couchbase/build/Release/couchbase_impl.node
    Expected in: dynamic lookup

Trace/BPT trap: 5

插入、upsert、get 等其他方法完美运行,但 'counter' 方法给我带来了这个特殊问题。

关于如何解决这个问题有什么想法吗?

显然,在 Mac Os X 10.10 上执行此操作时,库可以正常运行。 在 10.9.5 上它给出了这个特殊问题。

我自己设法解决了这个问题。 供参考:我是如何在 Mac OS X 10.9

上解决这个问题的

node_modules/couchbase/deps/lcb/gyp_config/mac/x64/config.h 中,我删除了以下代码行:

/* Have ntohll */
#include <arpa/inet.h>
#define HAVE_HTONLL

在 运行 手动安装 node-gyp 之后,一切都很顺利

cd node_modules/couchbase
node-gyp install && node-gyp build

如果你没有node-gyp,你可以使用

安装它
npm install -g node-gyp