I am trying to deploy my first contract :) However I keep getting the same error message:

Error HH100: Network mumbai doesn't exist

Here is my config:

// hardhat.config.js

module.exports = {
  solidity: "0.8.9",
  networks: {
    hardhat: {},
    mumbai: {
      url: process.env.API_URL,
      accounts: [`0x${process.env.PRIVATE_KEY}`],
      chainId: 80001, // Add the chainId for Mumbai network
  solidity: {
    version: "0.8.4",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200,

Here is what I am running:

npx hardhat run scripts/2_deploy_contracts.js --network mumbai

Appreciate any help!


2 Answers 2


Check sure your .env file is in the root directory of your project and contains the correct API_URL and PRIVATE_KEY variables. You can print them out to make sure they are being correctly loaded. For example, add the following lines in your hardhat.config.js file:

console.log('API_URL:', process.env.API_URL);
console.log('PRIVATE_KEY:', process.env.PRIVATE_KEY);

Just make sure to remove or comment out these lines when you've confirmed that your environment variables are being loaded correctly.

If that's not what's causing the issue, try reinstalling Hardhat:

npm uninstall hardhat
npm install --save-dev hardhat

Good luck.

  • Tried both solutions and still it didn't work. Still says: Error HH100: Network mumbai doesn't exist I have also added this constant: const { API_URL, PRIVATE_KEY } = process.env; to the hardhat.config. As well as reinstalling install dotenv --save, copied and pasted the api_url and private key from alchemy and Metamask (was definitely correct). I am definitely connected in Metamask, but I just can not connect to Mumbai from my project :(
    – Sam
    May 20, 2023 at 16:25


  1. npx hardhat clean

  2. restart after saving work

  3. npx hardhat run scripts/2_deploy_contracts.js --network mumbai

Hope this helps anyone else with this issue!

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.