如何解决npm 未在 Angular 11 中安装最新版本的 ngx-bootstrap
ng 添加 ngx-bootstrap 通过 npm 安装工具包。 通过 npm 安装的工具包。 发生未处理的异常:找不到模块“@schematics/angular/utility/config” 需要堆栈:
- C:\client\node_modules\ngx-bootstrap\schematics\ng-add\index.js
- C:\client\node_modules@angular-devkit\schematics\tools\export-ref.js
- C:\client\node_modules@angular-devkit\schematics\tools\index.js
- C:\client\node_modules@angular\cli\utilities\json-schema.js
- C:\client\node_modules@angular\cli\models\command-runner.js
- C:\client\node_modules@angular\cli\lib\cli\index.js
- C:\Users\Jaswik\AppData\Roaming\npm\node_modules@angular\cli\lib\init.js
- C:\Users\Jaswik\AppData\Roaming\npm\node_modules@angular\cli\bin\ng 有关详细信息,请参阅“C:\Users\Jaswik\AppData\Local\Temp\ng-2BGEbQ\angular-errors.log”。
解决方法
首先,您需要使用以下命令从 npm 在您的项目中安装 ngx-bootstrap:
npm install ngx-bootstrap --save
接下来,您需要将此链接添加到您的 HTML 文件中
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
您还可以使用 Angular CLI 11 的 ng add 命令通过简单地运行以下命令来自动将 ngx-bootstrap 添加到您的项目中:-
ng 添加 ngx-bootstrap
这个命令会自动添加必要的文件 您也可以使用此命令单独添加 ngx 文件
ng add ngx-bootstrap --component accordion
ng add ngx-bootstrap --component alerts
ng add ngx-bootstrap --component buttons
ng add ngx-bootstrap --component carousel
ng add ngx-bootstrap --component collapse
ng add ngx-bootstrap --component datepicker
ng add ngx-bootstrap --component dropdowns
ng add ngx-bootstrap --component modals
ng add ngx-bootstrap --component pagination
ng add ngx-bootstrap --component popover
ng add ngx-bootstrap --component progressbar
ng add ngx-bootstrap --component rating
ng add ngx-bootstrap --component sortable
ng add ngx-bootstrap --component tabs
ng add ngx-bootstrap --component timepicker
ng add ngx-bootstrap --component tooltip
ng add ngx-bootstrap --component typeahead
如果你想安装引导程序然后安装它 首先,我们将使用
安装依赖项开始npm install bootstrap --save
接下来,您需要使用以下命令从 npm 安装 ng-bootstrap:-
npm install --save @ng-bootstrap/ng-bootstrap
从'@ng-bootstrap/ng-bootstrap'导入{NgbModule};
如果你想用 Angular 11 安装引导程序
npm install bootstrap --save
有很多方法可以做到这一点。最简单的方法是使用 src/styles.css 文件并添加以下代码:
@import "~bootstrap/dist/css/bootstrap.css";
如果你想安装
,我今天也遇到了这个。我没有解决方案,但其他人在 Github 上对该项目提出了问题
https://github.com/valor-software/ngx-bootstrap/issues/6037
即使出现错误,ngx-bootstrap 似乎也已为我正确安装。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。