【问题标题】:Error using npm module activedirectory: "TypeError: activedirectory is not a constructor"使用 npm 模块 activedirectory 时出错:“TypeError:activedirectory 不是构造函数”
【发布时间】:2018-12-28 17:10:22
【问题描述】:

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

我已经安装了模块活动目录,它在 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

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

【问题讨论】:

  • 你可以尝试像这样导入它:var ActiveDirectory = require('activedirectory'); 吗?
  • 谢谢,我确实试过了。见下文 - 似乎最新的 Meteor 是问题所在。

标签: node.js meteor npm


【解决方案1】:

原来我没有在这个项目中安装activedirectory包。一个愚蠢的疏忽,但我本以为这些错误会更有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-14
    • 1970-01-01
    • 2014-08-17
    • 2016-08-10
    • 2022-10-30
    • 2018-10-30
    • 1970-01-01
    相关资源
    最近更新 更多