I am running a hardhat node on locahost using hardhat version 2.12.5 on a windows operating system for learning purpose. At times I close terminals without stopping the running node by CTRL+C
.
Is there a way for me to to stop the node without having to find its PID through systemctl
?
Maybe some npx hardhat command?
I tried to find something useful on hardhat's official documentation but found nothing there. I also tried asking ChatGPT for it and it suggested me to use npx hardhat halt
or npx hardhat stop
commands and none of them have worked for me.
Both the commands gave me the same error message
You could use the kill-port
utility to terminate the hardhat process which is listening at port e.g. 8545
.
$ npm i kill-port -g
$ kill-port 8545
#or via project install:
$ npm i kill-port
$ npx kill-port 8545