首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >编译契约时出错:找不到模块“@nomiclabs/hardhat-truffle5”

编译契约时出错:找不到模块“@nomiclabs/hardhat-truffle5”
EN

Ethereum用户
提问于 2023-04-30 02:00:48
回答 1查看 14关注 0票数 0

下面的错误是在通过硬帽子编译智能契约时发生的。

代码语言:javascript
复制
npx hardhat compile --show-stack-traces 

发生了一个意外错误:

代码语言:javascript
复制
Error: Cannot find module '@nomiclabs/hardhat-truffle5'
Require stack:
- /home/vasu/Desktop/Gravita-SmartContracts/hardhat.config.js
- /home/vasu/node_modules/hardhat/internal/core/config/config-loading.js
- /home/vasu/node_modules/hardhat/internal/cli/cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/vasu/Desktop/Gravita-SmartContracts/hardhat.config.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/vasu/Desktop/Gravita-SmartContracts/hardhat.config.js',
    '/home/vasu/node_modules/hardhat/internal/core/config/config-loading.js',
    '/home/vasu/node_modules/hardhat/internal/cli/cli.js'
  ]
}
EN

回答 1

Ethereum用户

发布于 2023-04-30 03:05:41

你还没把这个插件导入到安全帽里。转到您的hardhat.config.js并使用以下插件。

require("@nomicfoundation/hardhat-toolbox");

有关这方面的更多信息,请阅读“草帽”文档。

如果这不起作用,试着找到您需要的特定插件,在您的例子中,这个插件是“@moniclab/ hardhat -truffle5 5”,尝试在您的hardhat配置文件中导入这个插件。

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/149651

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档