Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8) #847
Answered
by
alymurtazamemon
OmarWaqar123
asked this question in
Q&A
-
at 7:07:30 when I'm trying to deploy using Ganache it is showing this error Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8) and the reason it is giving for this error is this {
reason: 'could not detect network',
code: 'NETWORK_ERROR',
event: 'noNetwork'
} I don't know what I'm doing wrong, I copied Patrick exactly but still, it's showing me this error. Here's the source code. const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
const provider = new ethers.providers.JsonRpcProvider(
"http://127.0.0.1:7545"
);
const wallet = new ethers.Wallet(
"82b3fcd6b32bf6da0026073533c3542f1bd507b9306e8c50ca831e0bf241c1b7",
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(); //STOP here! Wait for contract to deploy
console.log(contract);
}
main()
.then(() => Process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
}); |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Jul 9, 2022
Replies: 1 comment 2 replies
-
@OmarWaqar123 Follow this discussion, it is answered here #286 and also update this |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@OmarWaqar123 Follow this discussion, it is answered here #286
and also update this
Process.exit(0)
here p is small.