Ldapjs can't connect with a server

Viewed 1486

So I just want to create a connection to my LDAP server:

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

But no matter what I'll input for the url:

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

Connecting with the Apache Direct Studio is working fine. I'll also receive a runtime warning:

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

Has anyone a fix for this error?

2 Answers

dtrace-provider doesn't support Windows (and hence ldapjs which is build on top of dtrace also doesn't support 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:

In node_modules/ldapjs/lib/url.js we need to do the following changes, after the changes it working fine.

Error:

parsedURL = new url.URL(urlStr)

Solution:

parsedURL = new url.parse(urlStr)
Related