我有一个名为 index.js 的简单 NodeJS 文件,其中包含以下几行:
const {Auth0Lock} = require('auth0-lock');
var lock = new Auth0Lock( MyClientId, MyDomain);
lock.show();
我曾经npm install auth0-lock
安装 auth0lock 并拥有正确的package.json
文件。当我运行这段代码时node index.js
,我收到以下错误:
C:\Users\....\node_modules\auth0-lock\lib\utils\url_utils.js:6
var parser = global.document.createElement('a');
^
TypeError: Cannot read property 'createElement' of undefined
另外,当我更改const {Auth0Lock} = require('auth0-lock')
为时const Auth0Lock = require('auth0-lock')
,我收到以下错误:
var lock = new Auth0Lock(
^
TypeError: Auth0Lock is not a constructor
您能帮我解决这个错误并打开 auth0lock 身份验证对话框吗?