ethers-simple-storage-fcc icon indicating copy to clipboard operation
ethers-simple-storage-fcc copied to clipboard

Deploying the contract wont work. 7:07:25. Any help would be greatly appreciated.

Open egutierrez130 opened this issue 2 years ago • 4 comments

Hey all, for some reason, when I run this in the terminal --> node deploy.js
It will not deploy the contract. It is throwing this TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider') at main (/Users/edgargutierrez/hh-fcc/ethers-simple-storage-fcc/deploy.js:8:41) at Object. (/Users/edgargutierrez/hh-fcc/ethers-simple-storage-fcc/deploy.js:18:1)

Any help would be greatly appreciated. ps. I have redone the lesson and made sure all code is correct. My guess is that something is now outdated since 0.8.7 was a long time ago.

egutierrez130 avatar Feb 09 '23 06:02 egutierrez130

The newer version of Ethers seems to be unstable ethers 6.0.2... To solve this error downgrade your ethers version to 5.7.2 by going to your package.json

"ethers": "5.7.2",

now on your cli use npm install [email protected] or yarn add [email protected] depending on your package manager and that should solve your error.

mishdgr8 avatar Feb 09 '23 10:02 mishdgr8

@mishdgr8 Thank you so much! This worked for me! I appreciate the help! Now I can move forward! Thank you again!

egutierrez130 avatar Feb 16 '23 09:02 egutierrez130

@mishdgr8 @egutierrez130 I did change the ethers version as mentioned but after that its throwing a new error:

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2)
    at Logger.makeError (/home/rohit_kumar/prac/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:238:21)
    at Logger.throwError (/home/rohit_kumar/prac/ethers-simple-storage/node_modules/@ethersproject/logger/lib/index.js:247:20)
    at JsonRpcProvider.<anonymous> (/home/rohit_kumar/prac/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:609:54)
    at step (/home/rohit_kumar/prac/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
    at Object.throw (/home/rohit_kumar/prac/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
    at rejected (/home/rohit_kumar/prac/ethers-simple-storage/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  reason: 'could not detect network',
  code: 'NETWORK_ERROR',
  event: 'noNetwork'
}

pls help

rohitx01 avatar Feb 25 '23 11:02 rohitx01

Try this. Worked for me. Solution by Izmanovich https://github.com/PatrickAlphaC/ethers-simple-storage-fcc/issues/17

DengreSarthak avatar Jul 14 '23 07:07 DengreSarthak