Error: ENOENT: no such file or directory, open when running node deploy.js #965
Answered
by
alymurtazamemon
SarthakThakur0097
asked this question in
Q&A
-
const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
// compile them in our code
// cimpile them seperately
// HTTP://127.0.0.1:7545
const provider = new ethers.providers.JsonRpcProvider("HTTP://127.0.0.1:7545");
const wallet = new ethers.wallet("514f50da91ff1ac1e7732361c711fd9868a60dd3926911a68b2e896603d32d27",
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);
}
const abi = fs.readFileSync("");
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
}); Full Error Message: node:internal/fs/utils:344
throw err;
^
Error: ENOENT: no such file or directory, open
at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at Object.<anonymous> (/home/sthakur/folder/hh-fcc/ethers-simple-storage/deploy.js:22:16)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
errno: -2,
syscall: 'open',
code: 'ENOENT'
} |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Jul 14, 2022
Replies: 1 comment
-
@SarthakThakur0097 May be because of this |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
SarthakThakur0097
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@SarthakThakur0097 May be because of this
const abi = fs.readFileSync("");
Why did you add this extra here?