'TypeError: state.buffer is not iterable when using Hardhat
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)
Solution 1:[1]
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.
Solution 2:[2]
I had the same issue with node v16.14.0 .downgrading to node version v14.0.0 worked.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | johnny martinez |
| Solution 2 | user19184496 |

