node.js - 使用 npm 模块 activedirectory 时出错 : "TypeError: activedirectory is not a constructor"

标签 node.js meteor npm

我正在尝试使用 npm 模块 activedirectory在 Meteor 应用程序中,当我尝试按照文档创建新的事件目录时,出现错误。我正在从另一个 Meteor 项目中的工作示例进行复制,因此我知道配置值是正确的,并且我看不到我的项目和工作项目之间有任何其他有意义的差异。

我已经安装了模块activedirectory,它在node_modules目录中可见。

const activedirectory = require('activedirectory');

function getUserDataFromAD(username) {
    console.log(`typeof activedirectory ${typeof activedirectory}`);

    var AD = new activedirectory({
        url:'ldap://validurl',
        baseDN:'validDN',
        username:validUN,
        password:validPW,
    });
}

在控制台中我看到:

typeof activedirectory object
I20180720-12:33:09.073(1)? Exception while invoking method 'login' TypeError: activedirectory is not a constructor

有什么想法吗?这让我很困惑!

最佳答案

原来是我没有给这个项目安装activedirectory包。这是一个愚蠢的疏忽,但我希望这些错误会更有帮助。

关于node.js - 使用 npm 模块 activedirectory 时出错 : "TypeError: activedirectory is not a constructor",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51441689/

相关文章:

angularjs - NPM 对等要求错误

node.js - 找不到本地 Npm 模块 "GRUNT-PLUGIN-MODULE"。安装了吗?这是什么原因造成的?

node.js - 在生产中使用 MemoryStore

node.js - Azure 管道中的数据库迁移

node.js - nodejs PM2集群模式实现负载均衡

javascript - Meteor 集合查找并更新子数组中对象内的值

angular - Meteor 不渲染 html 模板,只渲染路径

javascript - 更改前缀后 npm 没有响应

javascript - 解决 Unresolved npm link symlink 需要的问题?

javascript - 如何使用带有 createReadStream 函数的 mocha 链接测试?