const provider= new ethers.provider.JsonRpcProvider('https://goerli.infura.io/ws/v3/48e3dcb8dcc3420fa8c765b7c04a75f8'); ^

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider') I downgraded the ether version but my one js file ran and another did not.

1 Answer 1


Notice that it is providers in plural. So it should look like ethers.providers.JsonRpcProvider(..).

const provider= new ethers.provider.JsonRpcProvider('https://goerli.infura.io/ws/v3/<PRJID>'); 

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.