尝试运行npx hardhat node
这是我得到的错误
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
这是我的配置文件。
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
}
}
要解决这个问题,您需要使用export SET NODE_OPTIONS=--openssl-legacy-provider
package.json
。"scripts": {
"start": "export SET NODE_OPTIONS=--openssl-legacy-provider && npx hardhat node"
},
然后,您可以运行yarn start
或export SET NODE_OPTIONS=--openssl-legacy-provider && npx hardhat node
https://github.com/webpack/webpack/issues/14532 issuecomment - 951378874