Search code examples
angularnpm-installngrx

What happened to NgRx npm package?


I have a legacy project (Angular v. 4.3.6) which was not updated for a while (more than half a year).

Now when I run npm install it complains that NgRx package cannot be installed. "ngrx": "^2.0.0" entry in package.json file.

npm ERR! code ETARGET
npm ERR! notarget No matching version found for ngrx@^2.0.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'code'
npm ERR! notarget

What should be used as a replacement for this dependency?


Solution

  • ngrx changed the way they distribute a while ago to be more modular and less monolithic. You should probably just update your project cause 4 is very out of date at this point, but you'll want to change ngrx to @ngrx/store at a minimum, and possibly add some other dependencies depending on what you were using. not sure what ngrx was offering back then, but good candidates are @ngrx/effects, and @ngrx/router-store

    you may also have to change your imports or possibly do a mapping in ts config?

    docs: https://ngrx.io/guide/store/install