一个月前,我开始了一个 Angular 7 项目。现在我需要将 Angular Material 加入到该项目中并使用“npm i”进行安装。最近发布了版本8,似乎与 Angular 7 不兼容。
因此,我开始更新 Angular 7 → Angular 8: “ng update @angular/cli @angular/core”。但是这会给我带来一个错误提示:
在这份指南https://update.angular.io/#7.0:8.0中,我找到了以下内容:
我的目标是:
因此,我开始更新 Angular 7 → Angular 8: “ng update @angular/cli @angular/core”。但是这会给我带来一个错误提示:
$ng update @angular/cli @angular/core
Package "@ngrx/core" has an incompatible peer dependency to "rxjs" (requires "^5.0.0-beta.12", would install "6.5.2").
Incompatible peer dependencies found. See above.
在这份指南https://update.angular.io/#7.0:8.0中,我找到了以下内容:
我应该使用rxjs^6。我需要"一旦您和您所有的依赖项都升级到RxJS 6,请删除rxjs-compat。"
rxjs-compat
才能使用由https://github.com/swagger-api/swagger-codegen生成的swagger客户端
。我尝试从package.json中删除"rxjs-compat": "^6.5.2"
,但没有成功。
package.json:
{
"name": "fem",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "$(npm bin)/cypress open",
"e2e-protractor": "ng e2e",
"swagger-generate": "swagger-codegen generate -i ./swagger.json -l typescript-angular -o ./src/swagger-client"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.2.15",
"@angular/cdk": "^8.0.1",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/material": "^8.0.1",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^7.4.0",
"@ngrx/entity": "^7.4.0",
"@ngrx/router-store": "^7.4.0",
"@ngrx/schematics": "^7.4.0",
"@ngrx/store": "^7.4.0",
"@ngrx/store-devtools": "^7.4.0",
"angular-in-memory-web-api": "^0.8.0",
"classlist.js": "^1.1.20150312",
"core-js": "^2.6.9",
"date-fns": "^1.30.1",
"formdata-polyfill": "^3.0.18",
"hammerjs": "^2.0.8",
"rxjs": "~6.3.3",
"rxjs-compat": "^6.5.2",
"tslib": "^1.9.0",
"uuid": "^3.3.2",
"web-animations-js": "^2.3.1",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular/cli": "~7.3.9",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@types/date-fns": "^2.6.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"@types/uuid": "^3.4.4",
"codelyzer": "~4.5.0",
"cypress": "^3.3.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
}
}
我的目标是:
- 在该项目中使用
Angular Material v8
- 升级到
Angular v8
- 继续使用生成的 Swagger 客户端