Skip to content

Lesson 8: I am getting error while unit testing #5327

Answered by alymurtazamemon
Jay-6957 asked this question in Q&A
Discussion options

You must be logged in to vote

@Jay-6957 For this error Cannot read properties of undefined (reading 'JsonRpcProvider') run this command;

npm install --save-dev ethers@^5

or

yarn add --dev ethers@^5

and as @pratokko said do not use getContractAt function instead use getContract function and if you have cannot find getContract function error, then run this command;

npm install -D hardhat-deploy @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers@^5

or

yarn add --dev hardhat-deploy @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers@^5

and add this inside hardhat.config.js file;

require('hardhat-deploy');

Replies: 5 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@prakhar9015
Comment options

@alymurtazamemon
Comment options

@MahzyarSaadat
Comment options

@alymurtazamemon
Comment options

@Ar11-kgp
Comment options

Answer selected by Jay-6957
Comment options

You must be logged in to vote
1 reply
@alymurtazamemon
Comment options

Comment options

You must be logged in to vote
1 reply
@xfcstunluo
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
9 participants