简体   繁体   中英

How to stop a hardhat node running on localhost?

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 eg 8545 .

$ npm i kill-port -g
$ kill-port 8545

#or via project install:
$ npm i kill-port
$ npx kill-port 8545

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM