我正在按照官方文档进行升级。
这一步已经顺利完成,没有任何错误。
ng update @angular/core@8 @angular/cli@8
下一步失败了。
ng update @angular/core @angular/cli
The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 45 dependencies.
Fetching dependency metadata from registry...
Package "@angular/core" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/animations" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/compiler" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/forms" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/common" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-browser" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/compiler-cli" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/router" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-browser-dynamic" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@ngtools/webpack" has an incompatible peer dependency to "typescript" (requires ">=3.4 < 3.6", would install "3.7.5").
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.
我检查了node_modules,发现tslib的正确版本已安装。
我手动添加了tslib条目,并运行npm install以查看错误是否消失。
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/common": "^8.2.14",
"@angular/compiler": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/forms": "^8.2.14",
"@angular/language-service": "^8.2.14",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
"@angular/router": "^8.2.14",
"@ng-bootstrap/ng-bootstrap": "^5.3.0",
"classlist.js": "^1.1.20150312",
"core-js": "^3.6.4",
"npm": "^6.13.7",
"rxjs": "^6.5.4",
"web-animations-js": "^2.3.2",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/architect": "^0.803.25",
"@angular-devkit/build-angular": "^0.803.25",
"@angular-devkit/build-optimizer": "^0.803.25",
"@angular-devkit/build-webpack": "^0.803.25",
"@angular-devkit/core": "^8.3.25",
"@angular-devkit/schematics": "^8.3.25",
"@angular/cli": "^8.3.25",
"@angular/compiler-cli": "^8.2.14",
"@ngtools/webpack": "^8.3.25",
"@schematics/angular": "^8.3.25",
"@schematics/update": "^0.803.25",
"@types/jasmine": "^3.5.4",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^12.12.27",
"tslib": "^1.10.0",
"codelyzer": "^5.2.1",
"jasmine-core": "^3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "^2.1.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.5.2",
"protractor": "^5.4.3",
"rxjs-tslint": "^0.1.7",
"ts-node": "^8.6.2",
"tslint": "^5.20.1",
"typescript": "~3.4",
"webpack": "^4.41.6",
"webpack-dev-server": "^3.10.3"
}
ng v output
Angular CLI: 8.3.25
Node: 12.13.0
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.24
@angular-devkit/build-angular 0.803.25
@angular-devkit/build-optimizer 0.803.24
@angular-devkit/build-webpack 0.803.25
@angular-devkit/core 8.3.24
@angular-devkit/schematics 8.3.24
@angular/cli 8.3.25
@ngtools/webpack 8.3.24
@schematics/angular 8.3.24
@schematics/update 0.803.24
rxjs 6.5.4
typescript 3.4.5
webpack 4.41.5
我还没有尝试使用--force选项。还有其他办法吗?