繁体   English   中英

无法为 Hardhat 项目安装软件包

[英]Can't install packages for Hardhat project

我想使用 Hardhat 环境创建一个项目。 我已经尝试从他们的角度遵循https://hardhat.org/getting-started/教程。 在那里,我们有一个提示来安装所有必需的软件包。 不幸的是,当我首先运行npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers时,我可以看到很多关于已弃用软件包的警告,然后

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/ethereumjs/ethereumjs-abi.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\(path)

我尝试安装ethereum-waffle并选择特定版本等。它总是以相同的错误结束。

你知道如何克服它吗? 为什么在安装过程中不推荐使用这么多软件包? 这个getting-started是否过时了,我应该以其他方式开始安全帽项目吗?

这个问题是由我的 node.js 版本引起的。当我更新时问题解决了

https://github.com/EthWorks/Waffle/issues/533

当您运行npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers时,您正在安装两者。 @nomicfoundation/hardhat-chai-matchers 插件旨在替代@nomiclabs/hardhat-waffle 插件。 所以只有一个是可以的。 我建议您迁移并使用 Hardhat Chai Matchers 插件。 使用此链接了解更多信息。 => “https://hardhat.org/hardhat-chai-matchers/docs/migrate-from-waffle”。 我希望这会有所帮助。

暂无
暂无

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

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