It is because the network setting of goerli
is not available in hardhat.config.js
:
// hardhat.config.js
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config()
// You need to export an object to set up your config
// Go to <https://hardhat.org/config/> to learn more
const GOERLI_URL = process.env.GOERLI_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.8.4",
networks: { // <============ START HERE
goerli: {
url: GOERLI_URL,
accounts: [PRIVATE_KEY]
}
} // <====================== END HERE
};
If you ensure the settings are there and the file has been saved, please check if the project that you are editing is the one that you are running in the command line:
cat hardhat.config.js
Check if the contents of hardhat.config.js
is the same as above, and use:
pwd
to check the path of the current directory.
code .
To open up vscode and check hardhat.config.js
again.