【问题标题】:How to clear the error while installing @ngrx/store?安装@ngrx/store 时如何清除错误?
【发布时间】:2021-04-17 13:41:39
【问题描述】:

这是我在安装@ngrx/store 时遇到的错误。谁能帮忙解决这个错误

PS C:\Users\Welcome\ngrx-test> npm install @ngrx/store
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree     
npm ERR! 
npm ERR! While resolving: ngrx-test@0.0.0
npm ERR! Found: @angular/core@11.0.8
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"~11.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"^10.0.0" from @ngrx/store@10.1.2
npm ERR! node_modules/@ngrx/store
npm ERR!   @ngrx/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\Welcome\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\Welcome\AppData\Local\npm-cache\_logs\2021-01-12T15_07_10_434Z-debug.log

【问题讨论】:

  • 尝试重新安装ngrx-store后尝试删除node_module并清除缓存。有时它是由于缓存而发生的。
  • 曾尝试使用命令-> npm cache clean --force,但它不起作用给定命令是否正确@Abhishek
  • 在运行此命令npm cache clear --force之后您是否尝试过删除node_module?
  • 删除节点模块后尝试..但显示相同的错误

标签: node.js angular npm ngrx


【解决方案1】:

以下是您可以尝试的可能解决方案:

删除节点模块和缓存

npm v5 及更高版本:

npx rimraf ./**/node_modules

npm cache clear --force

npm install @ngrx/store

npm v4 或以下:

npm install rimraf -g

rimraf .\**\node_modules

npm cache clear --force

npm install @ngrx/store

旧版对等依赖项

尝试使用旧版对等依赖项选项进行安装,该选项将在安装时忽略 peerDependencies

npm install @ngrx/store --legacy-peer-deps

强制

如果这不起作用,请尝试强制选项。

npm install @ngrx/store --force

@ngrx/store 的不同版本

如果以上选项均无效,您可以尝试安装不同版本的@ngrx/store

npm install @ngrx/store@10.0.0

node & npm 的不同版本

最后,作为最后的手段,您可以尝试降级或升级您的nodenpm 版本。

这里有instructions 说明如何操作。

希望这有帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-05
    • 2021-03-09
    • 2021-12-02
    • 2017-08-30
    • 1970-01-01
    • 1970-01-01
    • 2016-12-12
    相关资源
    最近更新 更多