tpa*_*tee 2 ng-bootstrap angular
我刚刚使用 Angular CLI 创建了一个全新的 Angular 10 项目,然后在设置了初始模块并路由并测试其工作原理后,我使用以下命令按照建议添加了 ng-bootstrap:
ng add @ng-bootstrap/schematics
现在,当我尝试ng serve我的项目时,出现以下错误:
Failed to compile entry-point @ng-bootstrap/ng-bootstrap (module as esm5) due to compilation errors:
../../node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.js:148:43 - error NG1006: Cannot combine @Input decorators with query decorators
148 "starTemplate": [{ type: Input }, { type: ContentChild, args: [TemplateRef,] },],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.module.js:12:51 - error NG6001: The class 'NgbRating' is listed in the declarations of the NgModule 'NgbRatingModule', but is not a directive, a component, or a pipe. Either remove it from the NgModule's declarations, or add an appropriate Angular decorator.
12 { type: NgModule, args: [{ declarations: [NgbRating], exports: [NgbRating], imports: [CommonModule] },] },
~~~~~~~~~
../../node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.js:14:5
14 var NgbRating = /** @class */ (function () {
~~~~~~~~~
'NgbRating' is declared here.
../../node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.js:14:5 - error NG6003: Appears in the NgModule.exports of NgbRatingModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.
Is it missing an Angular annotation?
14 var NgbRating = /** @class */ (function () {
~~~~~~~~~
../../node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.module.js:7:5 - error NG6002: Appears in the NgModule.imports of NgbRootModule, but itself has errors
7 var NgbRatingModule = /** @class */ (function () {
~~~~~~~~~~~~~~~
../../node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.module.js:7:5 - error NG6003: Appears in the NgModule.exports of NgbRootModule, but itself has errors
7 var NgbRatingModule = /** @class */ (function () {
~~~~~~~~~~~~~~~
../../node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.module.js:7:5 - error NG6002: Appears in the NgModule.imports of NgbModule, but itself has errors
7 var NgbRatingModule = /** @class */ (function () {
~~~~~~~~~~~~~~~
../../node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.module.js:7:5 - error NG6003: Appears in the NgModule.exports of NgbModule, but itself has errors
7 var NgbRatingModule = /** @class */ (function () {
Run Code Online (Sandbox Code Playgroud)
这只是 ng-bootstrap 包中的一个错误,还是我在项目中做错了什么,或者我如何添加 ng-bootstrap?有什么修复建议吗?
在 GitHub 项目和 package.json 文件中进行大量研究并尝试不同的东西后,似乎这@ng-bootstrap/schematics是一个用于安装的过时包。通过从我的 package.json 文件中删除它并添加"@ng-bootstrap/ng-bootstrap": "^6.0.0"然后运行npm update它解决了问题,我的项目再次正常工作。
| 归档时间: |
|
| 查看次数: |
2858 次 |
| 最近记录: |