![](/img/trans.png)
[英]Angular CLI - Cannot ng update @angular/core due to rxjs dependency
[英]Angular update using ng update @angular/cli @angular/core --allow-dirty --force
我將我的 Angular 項目 v8 更新到最后一次更新,但我遇到了問題。 我的package.json
如下:
{
"name": "website-admin-angular",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-material-components/datetime-picker": "^4.0.0",
"@angular/animations": "angular/animations-builds",
"@angular/cdk": "^8.2.3",
"@angular/common": "~8.0.3",
"@angular/compiler": "~8.0.3",
"@angular/core": "~8.0.3",
"@angular/forms": "~8.0.3",
"@angular/http": "^7.2.15",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "~8.0.3",
"@angular/platform-browser-dynamic": "~8.0.3",
"@angular/router": "~8.0.3",
"@fortawesome/angular-fontawesome": "^0.4.0",
"@fortawesome/fontawesome-svg-core": "^1.2.21",
"@fortawesome/free-solid-svg-icons": "^5.10.1",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"angular-bootstrap-md": "^8.1.0",
"angular-font-awesome": "^3.1.2",
"angular2-chartjs": "^0.5.1",
"angular2-jwt": "^0.2.3",
"chart.js": "^2.8.0",
"chartjs-plugin-annotation": "^0.5.7",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"jquery": "^3.4.1",
"material-design-icons": "^3.0.1",
"ng-http-loader": "^6.0.1",
"ng2-charts": "2.3.0",
"ng2-validation": "^4.2.0",
"ngx-cookie-service": "^2.2.0",
"ngx-filter-pipe": "^2.1.2",
"ngx-loading": "^3.0.1",
"ngx-toastr": "^10.0.4",
"ngx-ui-loader": "^8.0.0",
"rxjs": "^6.5.3",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.6",
"@angular/cli": "^8.3.21",
"@angular/compiler-cli": "~8.0.3",
"@angular/language-service": "~8.0.3",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
}
}
跑完之后
ng update @angular/cli @angular/core --allow-dirty --force
我的package.json
變成如下:
{
"name": "website-admin-angular",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-material-components/datetime-picker": "^4.0.0",
"@angular/animations": "^10.0.2",
"@angular/cdk": "^10.0.1",
"@angular/common": "~10.0.2",
"@angular/compiler": "~10.0.2",
"@angular/core": "~10.0.2",
"@angular/forms": "~10.0.2",
"@angular/http": "^7.2.16",
"@angular/material": "^10.0.1",
"@angular/platform-browser": "~10.0.2",
"@angular/platform-browser-dynamic": "~10.0.2",
"@angular/router": "~10.0.2",
"@fortawesome/angular-fontawesome": "^0.4.0",
"@fortawesome/fontawesome-svg-core": "^1.2.21",
"@fortawesome/free-solid-svg-icons": "^5.10.1",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"angular-bootstrap-md": "^8.1.0",
"angular-font-awesome": "^3.1.2",
"angular2-chartjs": "^0.5.1",
"angular2-jwt": "^0.2.3",
"chart.js": "^2.8.0",
"chartjs-plugin-annotation": "^0.5.7",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"jquery": "^3.4.1",
"material-design-icons": "^3.0.1",
"ng-http-loader": "^6.0.1",
"ng2-charts": "2.3.0",
"ng2-validation": "^4.2.0",
"ngx-cookie-service": "^2.2.0",
"ngx-filter-pipe": "^2.1.2",
"ngx-loading": "^3.0.1",
"ngx-toastr": "^12.1.0",
"ngx-ui-loader": "^8.0.0",
"rxjs": "^6.5.3",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1000.1",
"@angular/cli": "^10.0.1",
"@angular/compiler-cli": "~10.0.2",
"@angular/language-service": "~10.0.2",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"tslint": "~6.1.0",
"typescript": "~3.9.6"
}
}
並且在運行時
ng s -o
我收到這個錯誤
我的日志是
[error] Error: NGCC failed.
at NgccProcessor.process (E:\AdminPanelGit\node_modules\@ngtools\webpack\src\ngcc_processor.js:69:19)
at E:\AdminPanelGit\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:576:31
at SyncHook.eval [as call] (eval at create (E:\AdminPanelGit\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
at SyncHook.lazyCompileHook (E:\AdminPanelGit\node_modules\tapable\lib\Hook.js:154:20)
at Object.webpack [as webpackFactory] (E:\AdminPanelGit\node_modules\webpack\lib\webpack.js:55:30)
at createWebpack (E:\AdminPanelGit\node_modules\@angular-devkit\build-webpack\src\webpack-dev-server\index.js:21:36)
at Object.runWebpackDevServer (E:\AdminPanelGit\node_modules\@angular-devkit\build-webpack\src\webpack-dev-server\index.js:47:12)
at SwitchMapSubscriber.project (E:\AdminPanelGit\node_modules\@angular-devkit\build-angular\src\dev-server\index.js:164:32)
at SwitchMapSubscriber._next (E:\AdminPanelGit\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\operators\switchMap.js:49:27)
at SwitchMapSubscriber.Subscriber.next (E:\AdminPanelGit\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Subscriber.js:66:18)
at E:\AdminPanelGit\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\util\subscribeToPromise.js:7:24
at processTicksAndRejections (internal/process/task_queues.js:97:5)
按照https://update.angular.io/中的步驟操作 - 建議一次升級多個主要版本,即 8->9->10,而不是 8->10。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.