I want to update this code to Angular 14 from 12, but ng update
isn't working:
https://github.com/PacktPublishing/Reactive-Patterns-with-RxJS-for-Angular/tree/main/Chapter04
npm install
fails with:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/rxjs
npm ERR! rxjs@"7.5.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^6.5.3" from @angular/[email protected]
npm ERR! node_modules/@angular/core
npm ERR! @angular/core@"~12.1.1" from the root project
npm ERR! peer @angular/core@"12.1.5" from @angular/[email protected]
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"~12.1.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
ng update
gives:
Using package manager: npm
Collecting installed dependencies...
Found 0 dependencies.
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
@angular/cdk 12.2.13 -> 13.3.9 ng update @angular/cdk@13
@angular/cli 12.1.4 -> 13.3.9 ng update @angular/cli@13
@angular/core 12.1.5 -> 13.3.9 ng update @angular/core@13
The update commands all fail with a message like this:
$ ng update @angular/cdk@13
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 13.3.9 to perform the update.
✔ Packages successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 0 dependencies.
Package '@angular/cdk' is not a dependency.
ng version
shows:
Angular CLI: 14.2.1
Node: 16.17.0
Package Manager: npm 8.15.0
OS: linux x64
Angular: <error>
... animations, cdk, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1402.1 (cli-only)
@angular-devkit/build-angular <error>
@angular-devkit/core 14.2.1 (cli-only)
@angular-devkit/schematics 14.2.1 (cli-only)
@angular/cli 14.2.1 (cli-only)
@schematics/angular 14.2.1 (cli-only)
rxjs 6.6.7 (cli-only)
typescript <error>
How can I upgrade this source to Angular 14?
CodePudding user response:
npm is broken. Running yarn install
worked, with a few warnings about peer dependencies. The project runs.