我正在尝试运行cmd
npm install --save-dev "hardhat@^2.17.1" "@nomicfoundation/hardhat-toolbox@^3.0.0"
运行时我收到此错误日志
npm install --save-dev "hardhat@^2.17.1" "@nomicfoundation/hardhat-toolbox@^3.0.0"
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/ethers
npm ERR! ethers@"^5.7.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer ethers@"^6.1.0" from @nomicfoundation/[email protected]
npm ERR! node_modules/@nomicfoundation/hardhat-ethers
npm ERR! peer @nomicfoundation/hardhat-ethers@"^3.0.0" from @nomicfoundation/[email protected]
npm ERR! node_modules/@nomicfoundation/hardhat-toolbox
npm ERR! dev @nomicfoundation/hardhat-toolbox@"3.0.0" from the root project
npm ERR! peer @nomicfoundation/hardhat-ethers@"^3.0.0" from @nomicfoundation/[email protected]
npm ERR! node_modules/@nomicfoundation/hardhat-chai-matchers
npm ERR! peer @nomicfoundation/hardhat-chai-matchers@"^2.0.0" from @nomicfoundation/[email protected]
npm ERR! node_modules/@nomicfoundation/hardhat-toolbox
npm ERR! dev @nomicfoundation/hardhat-toolbox@"3.0.0" 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!
npm ERR! For a full report see:
npm ERR! C:\Users\\AppData\Local\npm-cache\_logs\2023-08-24T20_39_45_411Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: C:\Users\liamr\AppData\Local\npm-cache\_logs\2023-08-24T20_39_45_411Z-debug-0.log
PS C:\Users\liamr\tracking>
我首先做了npm i hardhat
,没有任何问题,然后我做了npx hardahat
,满足了所有要求,然后它说 You need to install these dependencies to run the sample project: npm install --save-dev "hardhat@^2.17.1" "@nomicfoundation/hardhat-toolbox@^3.0.0"
,我不小心做了 npm install --save-dev "hardhat@^2.17.1" 没有最后一个安全帽工具箱,然后我意识到我的错误,我现在被困在这里。
您已经
ethers
安装了版本 的库5.7.2
。但是您尝试安装的
@nomicfoundation/hardhat-toolbox
版本需要. 因此版本不匹配。3.0.0
6.1.0
ethers
您可以在此处执行以下两种方法之一:
@nomicfoundation/hardhat-toolbox
. 因此,不要尝试安装最新版本,而是尝试 v2。ethers
更新项目中已安装的版本。然后安装你的安全帽包。