【问题标题】:What happened to NgRx npm package?NgRx npm 包发生了什么?
【发布时间】:2019-12-06 15:34:01
【问题描述】:

我有一个遗留项目(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

应该用什么来代替这个依赖?

【问题讨论】:

  • @bryan60 我更新了问题

标签: angular npm-install ngrx


【解决方案1】:

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

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

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

【讨论】:

  • 好吧,看起来以前接触过它的人并没有费心去移除那个依赖。因为@ngrx 已经被引用了。
猜你喜欢
  • 2016-02-10
  • 2021-05-13
  • 1970-01-01
  • 2011-01-21
  • 1970-01-01
  • 2019-04-21
  • 1970-01-01
  • 2015-09-16
  • 1970-01-01
相关资源
最近更新 更多