到目前为止,我正在学习有关Udemy(https://www.udemy.com/course/build-an-app-with-aspnet-core-and-angular-from-scratch)的课程,非常好,直到我尝试安装ngx-bootstrap为止。
我在npm install ngx-bootstrap --save
项目上安装了Angular9
,在ng build
上收到以下错误:
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
解决此问题的方法是在角度项目的ngx-bootstrap
文件中packages.json
的版本号。
"dependencies": {
...
"ngx-bootstrap": "^5.5.0", // was "ngx-bootstrap": "^3.0.1",
...
},
将ngx-bootstrap
设置为最新值已解决了该问题。
正在运行npm install
和ng server
现在都没有相关错误并且可以继续运行。