找不到导出的节点名称(class ButtonRadioGroupDirective ...)

Failed to find exported name of node (class ButtonRadioGroupDirective ...)

我正在学习关于 Udemy (https://www.udemy.com/course/build-an-app-with-aspnet-core-and-angular-from-scratch) 的课程,到目前为止一切顺利,直到我尝试安装 ngx-bootstrap。

我在 Angular9 项目和 ng build 项目上安装了 npm install ngx-bootstrap --save 我收到以下错误:

Compiling ngx-bootstrap : es2015 as esm2015

ERROR in Failed to find exported name of node (class ButtonRadioGroupDirective {
    constructor(cdr) {
        this.cdr = cdr;
        this.onChange = Function.prototype;
        this.onTouched = Function.prototype;
    }
    get value() {
        return this._value;
    }
    set value(value) {
        this._value = value;
    }
    writeValue(value) {
        this._value = value;
        this.cdr.markForCheck();
    }
    registerOnChange(fn) {
        this.onChange = fn;
    }
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
}) in 'C:/Dev/DatingApp/DatingApp-SPA/node_modules/ngx-bootstrap/bundles/ngx-bootstrap.es2015.js'.

我遇到了以前的问题,我能够在这里找到解决方案:https://github.com/valor-software/ngx-bootstrap/issues/5242

不确定是否相关,但会分享以防万一:

ERROR in The target entry-point "ngx-bootstrap" has missing dependencies:
 - @angular/forms/src/directives/control_value_accessor
 - @angular/core/src/type

感谢您的帮助!如果我需要证明任何其他信息,请告诉我。

ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.3
Node: 12.16.1
OS: win32 x64

Angular: 9.0.2
... animations, common, compiler, compiler-cli, core
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.3
@angular-devkit/build-angular     0.900.3
@angular-devkit/build-optimizer   0.900.3
@angular-devkit/build-webpack     0.900.3
@angular-devkit/core              9.0.3
@angular-devkit/schematics        9.0.3
@angular/cli                      9.0.3
@angular/forms                    9.0.5
@ngtools/webpack                  9.0.3
@schematics/angular               9.0.3
@schematics/update                0.900.3
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

这个问题的解决方法是angular项目中的packages.json文件中ngx-bootstrap的版本号

"dependencies": {
     ...
     "ngx-bootstrap": "^5.5.0", // was "ngx-bootstrap": "^3.0.1",
    ...
},       

ngx-bootstrap 设置为最新解决了这个问题。

运行 npm installng serve 命令现在 运行 没有相关错误,可以继续进行。