0

Below error occurs while compiling smart contracts through hardhat.

npx hardhat compile --show-stack-traces 

An unexpected error occurred:

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'
  ]
}

1 Answer 1

0

you haven't imported the plugin for hardhat. Go to your hardhat.config.js and use the following plugin.

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

Read the Hardhat documentation for more info on this.

if this doesn't work try to find the specific plugin your need, which in your case is '@nomiclabs/hardhat-truffle5' Try importing this in your hardhat config file.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.