0

当我将它添加到应用程序模块中时,我刚刚安装了 ngx-charts 我得到了这个错误。

错误中的错误:模块 E:/Licenta/licenta/node_modules/@swimlane/ngx-charts/release/index.d.ts 的元数据版本不匹配,找到版本 4,预期为 3,解析 E:/Licenta/licenta 中的符号 AppModule /src/app/app.module.ts, 解析 E:/Licen ta/licenta/src/app/app.module.ts 中的符号 AppModule

这是我的 package.json 依赖项和 devDependencies 版本

"dependencies": {
"@angular-devkit/schematics": "0.0.40",
"@angular/animations": "^4.4.6",
"@angular/cdk": "^5.0.4",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/material": "^5.0.4",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@ngui/auto-complete": "^0.16.0",
"@swimlane/ngx-charts": "^7.0.1",
"angular-font-awesome": "^2.3.7",
"angular-slide-menu": "^0.5.0",
"angular2-fontawesome": "^0.9.3",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"d3": "^4.12.2",
"font-awesome": "^4.7.0",
"ionicons-npm": "^2.0.1",
"ng-sidebar": "^6.0.4",
"ng2-auto-complete": "^0.12.0",
"ng2-charts": "^1.6.0",
"ng2-input-autocomplete": "0.0.11",
"ngx-bootstrap": "^1.9.1",
"primeng": "^4.2.2",
"rxjs": "^5.4.1",
"zone.js": "^0.8.14"}


"devDependencies": {
"@angular/cli": "^1.6.3",
"@angular/compiler-cli": "^4.0.0",
"@angular/language-service": "^4.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "2.4.2"}
4

1 回答 1

0

ngx-charts v7.0.0 仅支持 Angular 5。您收到的错误是因为您使用的是 "@angular/compiler": "^4.0.0",它抱怨在使用 Angular 5 编译的 ngx-charts 版本 7.0.0 时元数据中的版本不匹配。

您应该升级到 Angular 5。

您可以使用 NCU 更新所有依赖项:

npm install -g npm-check-updates

ncu -u

npm install
于 2018-01-11T15:51:01.647 回答