gpt4 book ai didi

angular - 为什么我在 Angular 10 中安装 ng-bootstrap 后立即出现构建错误?

转载 作者:行者123 更新时间:2023-12-02 16:35:47 27 4
gpt4 key购买 nike

我刚刚使用 Angular CLI 创建了一个全新的 Angular 10 项目,然后在设置我的初始模块和路由并测试它是否正常工作之后,我使用以下命令按照推荐添加了 ng-bootstrap:

ng 添加@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 () {

这只是 ng-bootstrap 包中的错误,还是我在我的项目中做错了什么或我如何添加 ng-bootstrap?有什么修复建议吗?

最佳答案

在 GitHub 项目和 package.json 文件中进行大量挖掘尝试不同的东西之后,@ng-bootstrap/schematics 似乎是一个用于安装的过时包.通过从我的 package.json 文件中删除它并添加 "@ng-bootstrap/ng-bootstrap": "^6.0.0" 然后运行 ​​npm update 它解决了问题和我的项目再次工作。

关于angular - 为什么我在 Angular 10 中安装 ng-bootstrap 后立即出现构建错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62745680/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com