TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider') #4751
viveksharma1101980
started this conversation in
General
Replies: 1 comment 1 reply
-
checkout this other question |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi... I am working on ethers.js, and got "TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')"
code details are;
const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
// HTTP://127.0.0.1:7545
const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:7545");
const wallet = new ethers.Wallet("PRIVATE_KEY", provider);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin", "utf8");
const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("Deploying, please wait...");
const contract = await contractFactory.deploy();
console.log(contract);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
});
Can anyone please tell me where i did mistake ?
Beta Was this translation helpful? Give feedback.
All reactions