Invoking hardhat in a project with a local hardhat install should delegate to that version of Hardhat.
hardhat --version
# 3.1.0
cd ./my-hh-project
hardhat --version
# 3.0.0
Running hardhat as if locally without a local installation should error:
> rm -rf ./node_modules
> npx hardhat --version
Error HHxxx: Trying to use a non-local installation of Hardhat, which is not supported.
Please install Hardhat locally using npm or Yarn, and try again.
For more info go to https://hardhat.org/HHxxx or run Hardhat with --show-stack-traces
Hardhat can be installed as a global cli:
Invoking hardhat in a project with a local hardhat install should delegate to that version of Hardhat.
Running hardhat as if locally without a local installation should error: