Ldapjs 无法连接到服务器

Ldapjs can't connect with a server

所以我只想创建一个到我的 LDAP 服务器的连接:

var ldap = require('ldapjs');
var client = ldap.createClient({
  url: 'ldap://192.168.200.35:389'
});

但无论我为 url 输入什么:

TypeError: ldap://192.168.200.35:389 is an invalid LDAP url (scope)

与 Apache Direct Studio 的连接工作正常。 我还会收到运行时警告:

Module not found: Error: Can't resolve './src/build' in 'C:\...\node_modules\dtrace-provider'

有人解决了这个错误吗?

dtrace-provider 不支持 Windows(因此构建在 dtrace 之上的 ldapjs 也不支持 Windows OS):

This libusdt-based Node.JS module supports 64 and 32 bit processes on Mac OS X and Solaris-like systems such as illumos or SmartOS. As more platform support is added to libusdt, those platforms will be supported by this module. See libusdt's status at:

在node_modules/ldapjs/lib/url.js中我们需要做如下改动,改动后效果很好。

错误:

parsedURL = new url.URL(urlStr)

解法:

parsedURL = new url.parse(urlStr)