3

I installed hardhat-shorthand using the yarn package manager. However, running hh <code> throws the following error:

hh: command not found hardhat

I'm using the following code for installing the package:

yarn global add hardhat-shorthand

I'm referring the following doc: Link

3 Answers 3

3

Found the solution: Instead of yarn, use npm or npx for installing.

Use npm install --global hardhat-shorthand

Instead of yarn global add hardhat-shorthand

Hardhat team mentions something similar in their Context paragraph (refer below):

Out of best practice, Hardhat projects use a local installation of the npm package hardhat to make sure everyone working on the project is using the same version. This is why you need to use npx or npm scripts to run Hardhat. This approach has the downside of there being no way to provide autocomplete suggestions directly for the hardhat command, as well as making the CLI commands longer. These are the two issues that hh solves.

3

yarn won't complain if it can't install some components as a result of a lack of administrator privileges. Try doing the installation as root and it should work.

sudo yarn global add hardhat-shorthand
1
  • yep this is the best solution Commented Jul 17, 2023 at 16:36
0

you can add yarn bin in PATH:

yarn global dir # get yarn bin path

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.