I followed the instruction as hardhat's https://hardhat.org/getting-started/ .
npx hardhat node. And then I can connect to it with metamask.
npx hardhat run scripts/sample-script.js --network localhost to deploy the example.
But it returns me as below error:
TypeError: state.buffer is not iterable
like below:
$ npx hardhat run scripts/sample-script.js --network localhost
/Users/********/workspace/testHardhat1/node_modules/undici/lib/api/readable.js:211
for (const chunk of state.buffer) {
^
TypeError: state.buffer is not iterable
at consumeStart
(/Users/******/workspace/testHardhat1/node_modules/undici/lib/api/readable.js:211:29)
at processTicksAndRejections
(internal/process/task_queues.js:83:17)
Try updating your node version, I was using a node version that is non-compatible with hardhat (Version 10.01) and after update to 16.14.0 that issue was fixed.