我收到了这个错误:
/home/user/node_modules/ldapjs/lib/server.js:65
throw new TypeError('Invalid argument type: ' + typeof (argv[i]));
^
TypeError: Invalid argument type: undefined
at mergeFunctionArgs (/home/user/node_modules/ldapjs/lib/server.js:65:13)
at Server._mount (/home/user/node_modules/ldapjs/lib/server.js:814:35)
at Server.add (/home/user/node_modules/ldapjs/lib/server.js:500:15)
at Object.<anonymous> (/home/user/workspace/ldap/ldap.js:34:8)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)当尝试在ldapjs guide上进行测试时。
这个错误很大程度上阻碍了进一步的测试,因为服务不会启动。
发布于 2012-11-08 19:33:21
在为ldapjs分配函数数组之前(即,它当时是undefined ),您正在将pre传递给它。变量和函数声明被提升到顶部,但赋值不被提升。
移动这个
133. var pre = [authorize, loadPasswdFile];到顶部,或者至少在您将其传递给ldapjs之前。
赋值当前发生在第133行,但您已经在第34行传递了它:
34. server.add('ou=users, o=myhost', pre, function(req, res, next) 顺便说一句,通过在代码的开头设置以下内容,您应该能够更好地看到错误的来源:
Error.stackTraceLimit = Infinity;发布于 2012-11-07 15:50:14
我的“解决方案”是把这行代码一起注释掉。这肯定不是修复它的正确方法,但至少服务会在那时启动。
https://stackoverflow.com/questions/13265255
复制相似问题