簡體   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