-
Where the error refers To: const provider = new ethers.providers.JsonRpcProvider(
"HTTP://127.0.0.1:7545"
); Error: TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')
at main (/home/jobmwitah/patrikCollinsYT/ether-simple-storage/deploy.js:6:41)
at Object.<anonymous> (/home/jobmwitah/patrikCollinsYT/ether-simple-storage/deploy.js:24:1)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 Whole Code: 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(
"0x93fce421c99f0409b6e02700c80520a5c316d5775a5b408db8c7d27d6df993d9",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);
const contractFactory = ethers.contractFactory(abi, binary, wallet);
console.log("Please, wait...");
const contract = await contractFactory.deploy(); //STOP-HERE-AND-WAIT-FOR-CONTRACT-TO-DEPLOY
console.log(contract);
}
main()
.then(() => process.exit(0)) //If fulfilled .then() is called; process.exit(0) is Node.js saying the code "passed"
.catch((error) => {
//If Rejected .catch is called; process.exit(1) is Node.js saying the code "failed"
console.error(error);
process.exit(1);
}); Please anyone help identify the error😥😥🙏 |
Beta Was this translation helpful? Give feedback.
Answered by
aaankeet
May 30, 2023
Replies: 1 comment 7 replies
-
@Sloane-254 |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you are using latest version of ethers downgrade it to v5.7