安装@ngrx/store时如何清除错误?

How to clear the error while installing @ngrx/store?

这是我在安装 @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\_logs21-01-12T15_07_10_434Z-debug.log

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

正在删除节点模块和缓存

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

的不同版本

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

npm install @ngrx/store@10.0.0

不同版本的 node & npm

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

这里是 instructions 如何做到这一点。

希望对您有所帮助!