Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I'm new into Angular development and learning how to use Redux. While trying to install Redux using
Terminal
npm install redux @angular-redux/store --save
, the terminal throws up the following error:

Terminal
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: myapp@0.0.0
npm ERR! Found: @angular/core@14.2.12
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"^14.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"^7.0.0" from @angular-redux/store@10.0.0
npm ERR! node_modules/@angular-redux/store
npm ERR!   @angular-redux/store@"*" 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.
npm ERR! 
npm ERR! See C:\Users\Admin\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Local\npm-cache\_logs\2023-02-08T07_15_27_253Z-debug-0.log


What I have tried:

I tried installing redux and @angular-redux/store separately. That way, while redux is getting installed successfully, @angular-redux/store still throws up the same error. I tried checking for solutions, but in most forums,
Terminal
npm install redux @angular-redux/store --save
is the recommended command to install them. Even npm and the official sites say so.

Even after force install, I can't use
JavaScript
import { NgReduxModule, NgRedux } from '@angular-redux/store';
in app.module.ts, neither can I access
TypeScript
NgReduxModule
and
TypeScript
NgRedux
in the
TypeScript
imports
array of app.module.ts.

So what's wrong with my system? How do I get rid of the errors and can install Redux successfully? Please help as I'm new into it and finding it difficult to figure it out.

My development environment trivia:
1) Node: 18.12.1
2) Package Manager: npm 8.5.5
3) Angular CLI: 14.2.10
4) Angular: 14.2.12
5) OS: Windows 10 win32 x64

Regards.
Posted

1 solution

@angular-redux/store hasn't been updated in years and doesn't specify that it supports the latest Angular 15 version, which NPM considers as an error. This can be ignored using npm install --legacy-peer-deps, but Angular's official library support only includes libraries that are built no longer than 2 majors ago (so Angular 15 requires libraries that have been built using Angular 13+).

Hence, I opted to go with NgRx. I managed to install NgRx and learn the fundamentals of how to use it from this tutorial. Now my basic concepts of State, Action, Reducer and Store are clear.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900