尝试在我的 Angular 项目上安装 ngx-bootstrap 时出现问题

Problems trying to install ngx-bootstrap on my Angular project

我正在尝试在我的 angular 项目上安装 ngx-bootstrap,但是当我执行命令时:

ng add ngx-bootstrap

它给我以下错误:

An unhandled exception occurred: Cannot find module '@schematics/angular/utility/config'  
Require stack:
- C:\Users\xxx\Documents\app\node_modules\ngx-bootstrap\schematics\ng-add\index.js      
- C:\Users\xxx\Documents\app\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\xxx\Documents\app\node_modules\@angular-devkit\schematics\tools\index.js     
- C:\Users\xxx\Documents\app\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\xxx\Documents\app\node_modules\@angular\cli\models\command-runner.js
- C:\Users\xxx\Documents\app\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\xxx\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\xxx\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
See "C:\Users\xxx\AppData\Local\Temp\ng-nIyjnm\angular-errors.log" for further details.

我已经尝试安装 schematics 模块,但它总是给我同样的错误。

有人知道我该如何解决吗?

谢谢!

您需要重新安装angular原理图。

试试这个 -

npm uninstall @schematics/angular
npm cache clean
npm install @schematics/angular@YOUR_ANGULAR_VERSION

然后安装 ngx-bootstrap