簡體   English   中英

如何解決 hardhat vs code 中的這個錯誤

[英]how to solve this err in hardhat vs code

您正在使用不受 Hardhat 支持的 Node.js 版本,它可能無法正常工作,或者根本無法工作。 請確保您使用的是受支持的 Node.js 版本。要了解有關受支持的 Node.js 版本的更多信息,請訪問 go 至https://hardhat.org/nodejs-versions

一個意料之外的問題發生了:

 Error: Cannot find module '@nomiclabs/hardhat-waffle' Require stack: - D:\3.1\dppa\hardhat.config.js - D:\3.1\dppa\node_modules\hardhat\internal\core\config\config-loading.js - D:\3.1\dppa\node_modules\hardhat\internal\cli\cli.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:939:15) at Function.Module._load (node:internal/modules/cjs/loader:780:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (D:\3.1\dppa\hardhat.config.js:1:1) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:827:12) at Module.require (node:internal/modules/cjs/loader:1005:19) { code: 'MODULE_NOT_FOUND', requireStack: [ 'D:\\3.1\\dppa\\hardhat.config.js', 'D:\\3.1\\dppa\\node_modules\\hardhat\\internal\\core\\config\\config-loading.js', 'D:\\3.1\\dppa\\node_modules\\hardhat\\internal\\cli\\cli.js' ] } PS D:\3.1\dppa>

看起來您正在嘗試運行示例項目並且缺少插件。

如此所述,您需要使用以下命令為示例項目安裝一些插件。

npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers

除此之外,如提供的鏈接中所述,您應該使用Node.js的最新LTS ,即Node.js 16 ,可以在此處下載

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM