0

tried running npx hardhat node

this is the error I got

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

For more info go to https://hardhat.org/HH604 or run Hardhat with --show-stack-traces

here is my config file.

require('dotenv').config();
require("@nomiclabs/hardhat-ethers");

const KOVAN_RPC_URL = process.env.KOVAN_RPC_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;

module.exports = {
  defaultNetwork: "hardhat",
  networks: {
    hardhat: {
    },
    kovan: {
      url: KOVAN_RPC_URL,
      accounts: [PRIVATE_KEY]
    }
  },
  solidity: {
    version: "0.8.0",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  },
  paths: {
    sources: "./contracts",
    tests: "./test",
    cache: "./cache",
    artifacts: "./artifacts"
  },
  mocha: {
    timeout: 20000
  }
}
Patrick Collins
  • 5,621
  • 3
  • 26
  • 64
Clint Oka
  • 53
  • 8
  • Does this help? https://stackoverflow.com/a/69671888/11969592 – Patrick Collins Oct 26 '21 at 18:41
  • It totally worked!! I'll mark this question as duplicate. And try to search harder before posting a question. The Hackathon is so cool. Patrick Collins fielding questions. You are the best. Very approachable!!! – Clint Oka Oct 27 '21 at 00:44
  • Awesome :) Great work! If you could upvote that question too so others can be routed there, that would be great. – Patrick Collins Oct 27 '21 at 02:59
  • It's not working anymore. I don't know why. I was pasting that command right in the terminal. Am I supposed to insert that code into some config file? – Clint Oka Oct 27 '21 at 05:07
  • are you getting the same error? – Patrick Collins Oct 27 '21 at 19:17
  • It works now. Before the hardhat command I paste: export NODE_OPTIONS=--openssl-legacy-provider. But is there a way to insert this into the package.json. someone told me this is possible and I followed their instructions but it didn't work. – Clint Oka Oct 28 '21 at 01:27
  • 1
    it works. sorry that was a different error preventing me from moving forward. Both fixed Yaaay! but something is up with my Tasks logic lol. I'm going to do the workshop over. This is my third time... excited tho and I will keep trying. – Clint Oka Oct 28 '21 at 01:29
  • https://github.com/webpack/webpack/issues/14532#issuecomment-951378874 – Clint Oka Oct 28 '21 at 01:31
  • please upvote and accept the answer or edit it if it is correct – Patrick Collins Oct 28 '21 at 04:00

1 Answers1

2

To solve this, you need to update your package.json with export SET NODE_OPTIONS=--openssl-legacy-provider

  "scripts": {
    "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && npx hardhat node"
  },

Then, you can just run yarn start or export SET NODE_OPTIONS=--openssl-legacy-provider && npx hardhat node

https://github.com/webpack/webpack/issues/14532#issuecomment-951378874

Patrick Collins
  • 5,621
  • 3
  • 26
  • 64