2

I'm having some trouble trying to use the 'ldapjs'

In fact i'm stuck with the first instruction

var ldap = require('ldapjs');

I get this error:

Error: Module name "ldapjs" has not been loaded yet for context: _. Use require([]) http://requirejs.org/docs/errors.html#notloaded

I tried the solution as shown on the link above but it's not working either

I installed 'ldapjs' via npm install ldapjs

And i added the script for the "require" javascript file

Thanks

  • where is your script located (with respect to the node_modules dir)? – lipp Apr 26 '16 at 09:49
  • In the main directory there are index.html, script.js and node-modules dir. inside the node_modules dir there's a dir named ldapjs. I hope that answers your question – Idir Amrouche Apr 26 '16 at 12:16
  • could you run (in a new clean dir): npm install ldapjs && echo "require('ldapjs') ; console.log('ok') " > test.js && node test.js – lipp Apr 26 '16 at 12:20
  • if you see "ok" then installing and loading ldapjs in general works for you. – lipp Apr 26 '16 at 12:20
  • I don't get it, i can see ok when i run your command, but when i try it on google chrome i still get the same error on the console – Idir Amrouche Apr 26 '16 at 12:39
  • oh.... you want to use it in the browser!? than MAYBE browerify can help (http://browserify.org/) . Not all node modules can run in the browser. – lipp Apr 26 '16 at 12:43
  • Okay thank you for your help! – Idir Amrouche Apr 26 '16 at 12:48

0 Answers0