Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ng/Rx for Angular 14

I have just finished updating my old Angular v8, to Angular 14 (the latest).

I have now noticed the latest Ng/Rx packages, which I have installed are 13.2.0, however they seem to want Angular 13, i.e. if I do an npm i I get

    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE could not resolve
    npm ERR! 
    npm ERR! While resolving: @ngrx/[email protected]
    npm ERR! Found: @angular/[email protected]
    npm ERR! node_modules/@angular/core
    npm ERR!   @angular/core@"^14.0.2" from the root project
    npm ERR!   peer @angular/core@"14.0.2" from @angular/[email protected]
    npm ERR!   node_modules/@angular/animations
    npm ERR!     @angular/animations@"^14.0.2" from the root project
    npm ERR!     peerOptional @angular/animations@"14.0.2" from @angular/[email protected]
    npm ERR!     node_modules/@angular/platform-browser
    npm ERR!       @angular/platform-browser@"^14.0.2" from the root project
    npm ERR!       3 more (@angular/forms, @angular/platform-browser-dynamic, @angular/router)
    npm ERR!   12 more (@angular/common, @angular/compiler, @angular/forms, ...)
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer @angular/core@"^13.0.0" from @ngrx/[email protected]
    npm ERR! node_modules/@ngrx/effects
    npm ERR!   @ngrx/effects@"^13.2.0" from the root project
    npm ERR!
    npm ERR! Conflicting peer dependency: @angular/[email protected]
    npm ERR! node_modules/@angular/core
    npm ERR!   peer @angular/core@"^13.0.0" from @ngrx/[email protected]
    npm ERR!   node_modules/@ngrx/effects
    npm ERR!     @ngrx/effects@"^13.2.0" 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.

I don't want to go back to Angular 13 now, is there a way around this (without having to use --force?)

like image 308
peterc Avatar asked Oct 25 '25 18:10

peterc


1 Answers

I was getting a similar error for the 14.0.2 @ngrx/effects package. I had to do a two step process

Step 1

ng add @ngrx/store

at this point if I ran npm install I would get the same error again because the package.json file has been modified.

Step 2

Update to the latest version of 14 (You may need to increase this to the latest version at the time your reading this.)

ng update @ngrx/store@14

Test

Run npm install again to make sure the error goes away.

like image 90
David Yates Avatar answered Oct 27 '25 18:10

David Yates



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!