On using the command ng add @ngrx/store
, I am getting the below attached error.
However, the @ngrx package that gets installed is an old one "@ngrx/store": "^1.5.0",
.
My package.json
is:
// ...other packages
"dependencies": {
"@angular/animations": "~10.0.0",
"@angular/common": "~10.0.0",
"@angular/compiler": "~10.0.0",
"@angular/core": "~10.0.0",
"@angular/forms": "~10.0.0",
"@angular/platform-browser": "~10.0.0",
"@angular/platform-browser-dynamic": "~10.0.0",
"@angular/router": "~10.0.0",
"@ngrx/store": "^1.5.0",
"rxjs": "~6.5.5",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
},
When I am trying to modify the app.module.ts
file to add the StoreModule
manually, I am getting the below error too.
The NgRX official documentation says that they modify the below code using schematics:
Update your src/app/app.module.ts > imports array with StoreModule.forRoot({}).
My question, therefore is, Am I doing something wrong? How do I use the ng add @ngrx/store
command and solve all these mentioned issues?
UPDATE
It is a known bug with the Angular CLI v10.
Solution is to use
ng add @ngrx/store@latest