I tried to deploy my contract and got this error:

TypeError: Cannot read properties of undefined (reading 'utils')

I tried to use a few versions of ethers, but no luck.

I use utils here:

const { developmentChains } = require("../helper-hardhat-config")
const { network, ethers } = require("../hardhat.config")

const BASE_FEE = ethers.utils.parseEther("0.25") 

Any idea?

3 Answers 3


The import is wrong:

const { network, ethers } = require("../hardhat.config")

This should be:

const { ethers } = require("hardhat"); 

If you're using hardhat

const { ethers } = require("ethers"); 

If you're using ethers directly.


I was getting this error TypeError: Cannot read properties of undefined (reading 'computeAddress') I had this piece of code const {ethers} = require('ethers') - like @Adam Boudj suggested - and using it this way: const address = ethers.utils.computeAddress(key, index).

When I changed the import to const { computeAddress } = require("ethers") everything worked fine.

So I think if you change your import to const { parseEther} = require("ethers") and use it this way const BASE_FEE = parseEther("0.25") your code should work fine.


Problem in my case was with hardhat config file.

I was using hardhat-deploy to deploy the contract and missed to import hardhat-waffle in config file
Add this line on top of your hardhat-config-file


My entire setup

const { network, ethers, getChainId } = require('hardhat');
const { devChains, networkConfig } = require('../helper-hardhat-config');
const { verify } = require('../utils/verify');

const AMOUNT = ethers.utils.parseEther('2');




"devDependencies": {
        "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
        "@nomiclabs/hardhat-etherscan": "^3.0.0",
        "@nomiclabs/hardhat-waffle": "^2.0.1",
        "chai": "^4.3.4",
        "ethereum-waffle": "^3.4.0",
        "ethers": "^5.5.1",
        "hardhat": "^2.6.7",
        "hardhat-contract-sizer": "^2.4.0",
        "hardhat-deploy": "^0.9.29",
        "hardhat-gas-reporter": "^1.0.7",
        "prettier": "^2.4.1",
        "prettier-plugin-solidity": "^1.0.0-beta.19",
        "solhint": "^3.3.6",
        "solidity-coverage": "^0.7.13"

Note: Don't use ethers version 6 as its unstable

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.