NgRx npm 包发生了什么?

What happened to NgRx npm package?

我有一个遗留项目(Angular v. 4.3.6)有一段时间(超过半年)没有更新了。

现在当我 运行 npm install 它抱怨无法安装 NgRx 包。 "ngrx": "^2.0.0" 条目在 package.json 文件中。

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

应该使用什么来替代此依赖项?

ngrx 改变了他们不久前的分发方式,使其更加模块化而不是单一。您可能应该只更新您的项目,因为此时 4 已经过时了,但是您至少要将 ngrx 更改为 @ngrx/store,并可能根据您的需要添加一些其他依赖项正在使用。不确定 ngrx 当时提供什么,但好的候选者是 @ngrx/effects@ngrx/router-store

您可能还必须更改导入或可能在 ts 配置中进行映射?

文档:https://ngrx.io/guide/store/install