Sul*_*ota 8 javascript node.js npm reactjs
因此,我从 Creative Tim 的网站购买了高级仪表板主题,现在当我尝试使用它时,我无法安装软件包。当我运行时,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
Run Code Online (Sandbox Code Playgroud)
如何修复此错误。我也尝试过 --legacy-peer-deps 和 --force 。似乎什么都不起作用。
小智 7
我遇到了这个问题,两种解决方案中的任何一个都对我有用。他们是:
npm install --legacy-peer-deps
如果您好奇它的作用是什么?这些软件包将使用 --legacy 标志安装。该命令在安装时会忽略所有对等依赖项,采用 npm 版本 4 到版本 6 的风格。
此错误来自 npm 7.x 版本。因此,另一个解决方案是降级到 npm 6.x。
参考:请参阅此以获取更多信息