Closed CaptSinBad closed 1 year ago
This is my code
const ethers = require("ethers"); const fs = require("fs-extra"); async function main() { const provider = new ethers.providers.JsonRpcProvider( "http://172.20.48.1:7545" ); const Wallet = new ethers.Wallet( "privateKey", 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, binrary, wallet); console.log("Deploying...please wait"); const contract = await contractFactory.deploy(); console.log(contract); } main() .then(() => ProcessingInstruction.exit(0)) .catch((error) => { console.error(error); process.exit(1); });
this is the error I get:
throw err; ^ Error: Cannot find module 'ethers' Require stack: - /home/nerdynedo/new_folder/hh-fcc/ethers-simple-storage/deploy.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/nerdynedo/new_folder/hh-fcc/ethers-simple-storage/deploy.js:1: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) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/nerdynedo/new_folder/hh-fcc/ethers-simple-storage/deploy.js' ] }
I had to re-download ethers using yarn add ethers
yarn add ethers
This is my code
this is the error I get: