husky: Unable to make husky work with yarn pnp on windows

I set the HUSKY_USE_YARN option but I’m still getting the following error on Windows 10 …

error Command “husky-run” not found.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Cf https://github.com/typicode/husky/issues/560#issuecomment-520827817 - tl;dr there’s a bug in Yarn 1 which is fixed in Yarn 2 (which is the generally recommended version to use when using PnP).

Can you confirm you use Yarn 2? The issue I mentioned is still in the v1.

My bad. Was mistakenly using Yarn 1 in another repo when I tried this. I can confirm it works flawlessly with Yarn 2 👌

I’ve published a new version, which is a very early v4.0.0 version. It should support Yarn PnP out of the box.

You can give it a try using yarn add husky@next --dev.

Feedback is welcome.

For a global cache, you’ll be looking for enableGlobalCache (it’s similar to setting a custom cacheFolder, except that you won’t have to remember which path it should be when configuring other projects).

#562 was merged and husky v4.0.0-beta.1 was published

Btw what’s the status on this PR?

Another approach is currently being taken (the one with yarn husky-run).