I'm using web3 version 1.8.0

enter image description here

it always shows this error "Uncaught TypeError: Cannot read properties of undefined (reading 'Contract')"

1 Answer 1


you have two import "web3". one is

import web3 from 'web3'

otherone is

// you are using Web3 in your contract
// this is overwriting
import Web3 from 'web3"

remove the first one

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.