node.js - "npm install @azure/msal-browser @azure/msal-angular@latest"但node_modules 内没有任何内容

标签 node.js angular azure npm

我尝试包含 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:找不到模块“@azure/msal-browser”或其相应的类型声明

运行命令时,它似乎安装了所有内容(我在前端所在的位置运行它,也尝试在存储前端和后端的文件夹中运行它):

npm WARN @angular/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f89b9c93b8c1d6cad6cc" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of tslib@^1.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="58313b37362b7539363f2d34392a186176687669" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of @angular/common@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3b5258545548165a555c4e575a497b02150b150a" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of @angular/core@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b3dad0dcddc09ed2ddd4c6dfd2c1f38a9d839d82" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of @angular/platform-browser@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="442d272b2a3769252a2331282536047d6a746a75" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of tslib@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN @rollup/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6f1f031a080601420c0002020001051c2f5e5a415e415f" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of rollup@^2.22.0 but none is installed. You must install peer dependencies yourself.
npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e0d010a0b0217140b1c2e5b405c405c" rel="noreferrer noopener nofollow">[email protected]</a> 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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e3808c87868f9a998691a3d6cdd1cdd1" rel="noreferrer noopener nofollow">[email protected]</a> 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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7b151c560114090914561a150f1f3b4255495549" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of @angular/animations@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="49272e6433263b3b266428273d2d0970677b677b" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of @angular/common@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0c626b2176637e7e63216d6278684c35223e223e" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of @angular/forms@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cba5ace6b1a4b9b9a4e6aaa5bfaf8bf2e5f9e5f9" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of @angular/core@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cea0a9e3b4a1bcbca1e3afa0baaa8ef7e0fce0fc" rel="noreferrer noopener nofollow">[email protected]</a> requires a peer of @angular/platform-browser@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cca2abe1b6a3bebea3e1ada2b8a88cf5e2fee2fe" rel="noreferrer noopener nofollow">[email protected]</a> 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: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfb9acbaa9bab1abac9fedf1eef1ec" rel="noreferrer noopener nofollow">[email protected]</a> (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f096839586959e8483b0c2dec1dec3" rel="noreferrer noopener nofollow">[email protected]</a>: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aec8ddcbd8cbc0daddee9f809c809f9d" rel="noreferrer noopener nofollow">[email protected]</a> (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1a7c697f6c7f746e695a2b3428342b29" rel="noreferrer noopener nofollow">[email protected]</a>: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7b1a4b2a1b2b9a3a497e6f9e5f9e6e4" rel="noreferrer noopener nofollow">[email protected]</a> (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f593869083909b8186b5c4dbc7dbc4c6" rel="noreferrer noopener nofollow">[email protected]</a>: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @azure/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="87eaf4e6ebaae5f5e8f0f4e2f5c7b5a9b5b7a9b7" rel="noreferrer noopener nofollow">[email protected]</a>
+ @azure/msal-angula<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e3c0e7c607e6078" rel="noreferrer noopener nofollow">[email protected]</a>
updated 2 packages and audited 1717 packages in 11.119s

最佳答案

几乎是唯一的方法npm将在 ./node_modules 以外的目录中安装某些内容是如果 global 已设置。运行npm config get global 。如果打印 true ,那么这就是你的问题。

找出位置global设置为 npm config list 。查找global = true在输出中,然后开始在其上方的行中查找类似于 ; "user" config from /Users/trott/.npmrc 的行。该行将告诉您问题是否出在您的用户配置、项目配置或全局配置中。您可以尝试使用npm config delete global删除该设置,但 global设置本身可能会扰乱该命令。 (我实际上不确定原因。我所知道的是我经历过 npm config delete global 没有效果。)最好运行 npm config edit编辑配置文件以删除该行。 (您还可以使用该路径在您选择的编辑器中打开文件。只需非常小心,除了删除 global 设置行之外,不要进行任何更改。)

关于node.js - "npm install @azure/msal-browser @azure/msal-angular@latest"但node_modules 内没有任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70274675/

相关文章:

azure - DocumentDB数据迁移工具,无法从db迁移到db

java - Octopus 在 jar 文件中部署替代变量

node.js - 如何在ftp服务器上运行node.js脚本?

javascript - Node.js + TypeScript : Unclear syntax with type script compiled code

javascript - 在 Angular 2 中使用 require 设置 templateUrl 时出现错误

angular - ionic 2 ngFor ionic 选项抛出错误

javascript - 使用map()将json数据转换为对象

javascript - 从 node.js 中的变量解析 CSV 表

javascript - 等待回调函数完成后再继续

azure - 如何在任务 DotNetCoreCLI@2 中使用 "nuget push"和 --skip-duplicate 选项