Error Message when `forge` not installed
The error message for hardhat compile when forge is not installed does not tell users this fact. This could help users debug the build process more easily. The following error is produced:
An unexpected error occurred:
TypeError: Cannot read properties of null (reading 'code')
at analyzeModuleNotFoundError (/home/circleci/project/node_modules/hardhat/src/internal/core/config/config-loading.ts:161:13)
at Environment.run (/home/circleci/project/node_modules/hardhat/src/internal/core/runtime-environment.ts:136:33)
at async main (/home/circleci/project/node_modules/hardhat/src/internal/cli/cli.ts:218:5)
error Command failed with exit code 1.
Following the above stack trace:
- The hh cli - https://github.com/NomicFoundation/hardhat/blob/64456a03fcdd75cc7b22ca1d4085e72beab68e73/packages/hardhat-core/src/internal/cli/cli.ts#L214
- An error is thrown and caught here - https://github.com/NomicFoundation/hardhat/blob/64456a03fcdd75cc7b22ca1d4085e72beab68e73/packages/hardhat-core/src/internal/core/runtime-environment.ts#L136
I would expect to see this in the logs but do not for some reason. https://github.com/foundry-rs/hardhat/blob/ba96df24332eec3b38bf6997ef74f8391c0bcccf/packages/easy-foundryup/src/binary.ts#L192
Devs are getting confused by the error message above and I'm trying to think of what is most convenient for an outside contributor when it comes to getting foundry. I don't love the idea of a postinstall hook that uses easyfoundryup if forge isn't in the PATH when calling yarn in the optimism monorepo but that would be convenient