0

I'm trying to get help with the command yarn hardhat verify --help. I get the following error

yarn run v1.22.19
$ F:\Aleksey\Study\Blockchain\projects\hardhat-simple-storage-fcc\node_modules\.bin\hardhat verify --help
An unexpected error occurred:

Error: Cannot find module '@nomicfoundation/hardhat-etherscan'
Require stack:
- F:\Aleksey\Study\Blockchain\projects\hardhat-simple-storage-fcc\hardhat.config.js
- F:\Aleksey\Study\Blockchain\projects\hardhat-simple-storage-fcc\node_modules\hardhat\internal\core\config\config-loading.js
- F:\Aleksey\Study\Blockchain\projects\hardhat-simple-storage-fcc\node_modules\hardhat\internal\cli\cli.js       
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (F:\Aleksey\Study\Blockchain\projects\hardhat-simple-storage-fcc\hardhat.config.js:4:1)    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'F:\\Aleksey\\Study\\Blockchain\\projects\\hardhat-simple-storage-fcc\\hardhat.config.js',
    'F:\\Aleksey\\Study\\Blockchain\\projects\\hardhat-simple-storage-fcc\\node_modules\\hardhat\\internal\\core\\config\\config-loading.js',
    'F:\\Aleksey\\Study\\Blockchain\\projects\\hardhat-simple-storage-fcc\\node_modules\\hardhat\\internal\\cli\\cli.js'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

hardhat.config.js:

// const env = require("hardhat");

require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-etherscan");
require("dotenv").config();

const GOERLI_RPC_URL = process.env.GOERLI_RPC_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY;

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
    defaultNetwork: "hardhat",
    networks: {
        goerli: {
            url: GOERLI_RPC_URL,
            accounts: [PRIVATE_KEY],
            chainId: 5,
        },
    },
    etherscan: {
        apiKey: ETHERSCAN_API_KEY,
    },
    solidity: "0.8.8",
};

I installed this module, its version is the latest, tried to roll back to 3.0.1 and 3.0.3, nothing has changed

1 Answer 1

0

It should be

require("@nomiclabs/hardhat-etherscan");

instead of

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

Your Answer

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

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