【发布时间】:2022-01-13 09:14:10
【问题描述】:
我试图在登录时包含 Azure AD,但在运行 npm install @azure/msal-browser @azure/msal-angular 以及 npm install @azure/msal-browser @azure/msal-angular@latest 之后,在 node_modules 文件夹中看不到新条目。所以当尝试导入模块时
import { MsalModule } from '@azure/msal-angular';
import { PublicClientApplication } from '@azure/msal-browser';
我收到警告 TS2307: Cannot find module '@azure/msal-browser' or its corresponding type declarations
运行命令时,它似乎安装了所有东西(我在前端所在的位置运行它,也尝试在存储前端和后端的文件夹中运行它):
npm WARN @angular/cdk@9.2.4 requires a peer of tslib@^1.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/icons-angular@9.0.1 requires a peer of @angular/common@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/icons-angular@9.0.1 requires a peer of @angular/core@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/icons-angular@9.0.1 requires a peer of @angular/platform-browser@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/icons-angular@9.0.1 requires a peer of tslib@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN @rollup/plugin-commonjs@15.1.0 requires a peer of rollup@^2.22.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@5.2.2 requires a peer of @angular/compiler@>=2.3.1 <10.0.0 || >9.0.0-beta <10.0.0 || >9.1.0-beta <10.0.0 || >9.2.0-beta <10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@5.2.2 requires a peer of @angular/core@>=2.3.1 <10.0.0 || >9.0.0-beta <10.0.0 || >9.1.0-beta <10.0.0 || >9.2.0-beta <10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng-zorro-antd@9.2.2 requires a peer of @angular/animations@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng-zorro-antd@9.2.2 requires a peer of @angular/common@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng-zorro-antd@9.2.2 requires a peer of @angular/forms@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng-zorro-antd@9.2.2 requires a peer of @angular/core@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng-zorro-antd@9.2.2 requires a peer of @angular/platform-browser@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng-zorro-antd@9.2.2 requires a peer of @angular/router@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ @azure/msal-browser@2.20.0
+ @azure/msal-angular@2.0.6
updated 2 packages and audited 1717 packages in 11.119s
【问题讨论】:
-
您是否在前端所在的位置运行
npm install?你看到包被添加到 package.json 了吗?您是否收到错误消息或警告?请向我们提供其他(相关)数据,以便我们为您提供帮助。 -
@rickvdbosch 我已经用更多信息更新了这个问题
-
您必须运行文件 package.json 所在的命令。这些命令将在本地 node_modules 文件夹中安装包
-
@danvid 这就是我所做的,进入 package.json 所在的前端文件夹,运行命令,它似乎通过了,但是 node_modules 文件夹中没有任何内容,当尝试将其导入应用程序时.module 它给了我上面提到的错误