ldapjs-community is a community-maintained, independent fork of ldapjs v2. It is not affiliated with or endorsed by the original ldapjs maintainers.
Link to Check compatibility firstCheck compatibility first
Use this path only when the application depends on the ldapjs v2 API. The upstream README explicitly says ldapjs v3 users should not switch yet.
The published package declares a Node.js engine of >=10.13.0. Its 2.4.0 release notes separately record a CI matrix of Node.js 18, 20, 22, and 24. The engine declaration and tested matrix describe different things; neither is a guarantee for an untested deployment.
Link to Install the replacementInstall the replacement
Install the fork under the original dependency name so existing imports remain unchanged:
npm install ldapjs@npm:ldapjs-community@^2.4.0
Verify the resolved package:
npm ls ldapjs
The dependency tree should resolve ldapjs to ldapjs-community 2.4.0 or another version allowed by the declared range.
Link to Create and bind a clientCreate and bind a client
Set LDAP_URL, LDAP_BIND_DN, and LDAP_PASSWORD, then run:
const ldap = require('ldapjs')
const client = ldap.createClient({
url: process.env.LDAP_URL
})
client.on('error', (err) => {
console.error('LDAP connection error:', err)
})
client.bind(process.env.LDAP_BIND_DN, process.env.LDAP_PASSWORD, (err) => {
if (err) {
client.destroy()
throw err
}
console.log('LDAP bind succeeded')
client.unbind()
})
Link to ContinueContinue
- Use the search example to retrieve entries.
- Review the Client API before adding other LDAP operations.
- Configure TLS or StartTLS before sending credentials across an untrusted network.
For bind semantics, read LDAP bind explained.