12

I am setting up hardhat in Linux. I have set up the react app first using these commands.

npx create-react-app react-dapp

cd react-dapp 

Then I have installed some hardhat dependencies using this command.

npm install ethers hardhat @nomiclabs/hardhat-waffle \
        ethereum-waffle chai \
        @nomiclabs/hardhat-ether

This all done correctly. Then I have created the hardhat configs and setup.

npx hardhat 

Then I have edited the hardhat.config.js file. I have places this.

module.exports = {
solidity: "0.8.4",
paths: {                         
   artifacts: './src/artifacts',  
},
networks: {                 
  hardhat: {
   chainId: 1337                
 }

} }; After that I have created the node.

npx hardhat node 

I got this error:

Error HH604: Error running JSON-RPC server: error:0308010C:digital envelope routines::unsupported

enstazao
  • 121
  • 1
  • 8

6 Answers6

27

Had the same problem. Using Node 17.x and it has an updated openssl that is a a breaking change.

This worked for me because I'm using yarn.

export NODE_OPTIONS=--openssl-legacy-provider

You could also try just using the --openssl-legacy-provider switch on node.

lenifoti
  • 371
  • 2
  • 2
9

I was able to solve the problem using lts node version using nvm.

nvm install --lts
nvm use --lts
Abhishek Sinha
  • 5,095
  • 1
  • 15
  • 14
3

I ran into this exact problem just now, however since I have nvm, my cheap work around is to used node v16 for now.

Ogbee
  • 51
  • 4
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 28 '21 at 07:10
0

I was also facing the same problem. However, updating the package.json file worked for me. You will have to update "scripts/start" dependency as shown in the image below: enter image description here

start:"export SET NODE_OPTIONS=--openssl-legacy-provider && npx hardhat node"

ouflak
  • 2,458
  • 10
  • 44
  • 49
vamsin
  • 11
  • 2
0

I was having the same problem running node 18.10.0 and was able to fix it with enter image description here

and then running this command "npm install --save-dev hardhat"

0

This helped me: "npm update --legacy-peer-deps"

Vaidas D.
  • 193
  • 3
  • 8