简体   繁体   English

npm 安装无法解析依赖树

[英]npm install unable to resolve dependency tree

So I bought the premium dashboard theme from Creative Tim's site and now when I am trying to work on it I am unable to install the packages.因此,我从 Creative Tim 的网站购买了高级仪表板主题,现在当我尝试使用它时,我无法安装软件包。 When I run npm install I get the following error:当我运行npm install时,出现以下错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: argon-dashboard-pro-react@1.2.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.3.0" from react-bootstrap-table-next@4.0.3
npm ERR! node_modules/react-bootstrap-table-next
npm ERR!   react-bootstrap-table-next@"4.0.3" 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\acer\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\acer\AppData\Local\npm-cache\_logs\2021-02-08T12_06_48_302Z-debug.log

How to fix this error.如何修复此错误。 I've tried --legacy-peer-deps and --force as well.我也尝试过 --legacy-peer-deps 和 --force。 Nothing seems to work.似乎没有任何效果。

I faced this issue and either of the two solutions worked for me.我遇到了这个问题,这两种解决方案中的任何一种都对我有用。 They are:他们是:

  1. npm install --legacy-peer-deps

    In case you are curious what it does?如果你好奇它是做什么的? The packages will install with the --legacy flag.这些软件包将使用 --legacy 标志安装。 The command ignores all peer dependencies when installing, in the style of npm version 4 through version 6.该命令在安装时忽略所有对等依赖项,样式为 npm 版本 4 到版本 6。

  2. This error comes from version 7.x of npm. Hence, another solution is to downgrade to npm 6.x.此错误来自npm的7.x版本。因此,另一种解决方案是降级到npm 6.x。

Reference: Refer this for more info参考: 请参阅此以获取更多信息

I encountered a similar error and adding --legacy-peer-deps resolved it for me.我遇到了类似的错误并添加 --legacy-peer-deps 为我解决了它。 npm install --legacy-peer-deps . npm install --legacy-peer-deps

Read more about '--legacy-peer-deps' here . 在此处阅读有关“--legacy-peer-deps”的更多信息。

Try this commands试试这个命令

npm cache clean --force

npm install --legacy-peer-deps

Using a force/ legacy --legacy-peer-deps is to accept a incorrect peer dependency, its better to figure out what are the peer dependency for the package u are trying to install, and see its peer dependency version and the update your projects dependency to match the peer dependency of the package使用 force/ legacy --legacy-peer-deps 是为了接受不正确的对等依赖,最好弄清楚你正在尝试安装的 package 的对等依赖是什么,并查看其对等依赖版本并更新你的项目依赖匹配 package 的对等依赖

So I bought the premium dashboard theme from Creative Tim's site and now when I am trying to work on it I am unable to install the packages.所以我从 Creative Tim 的网站上购买了高级仪表板主题,现在当我尝试使用它时,我无法安装这些软件包。 When I run npm install I get the following error:当我运行npm install时,我收到以下错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: argon-dashboard-pro-react@1.2.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.3.0" from react-bootstrap-table-next@4.0.3
npm ERR! node_modules/react-bootstrap-table-next
npm ERR!   react-bootstrap-table-next@"4.0.3" 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\acer\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\acer\AppData\Local\npm-cache\_logs\2021-02-08T12_06_48_302Z-debug.log

How to fix this error.如何修复此错误。 I've tried --legacy-peer-deps and --force as well.我也试过 --legacy-peer-deps 和 --force 。 Nothing seems to work.似乎没有任何效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM