Open anatolykazantsev opened 1 year ago
I have the same issue. I downgraded and locked version to 2.3.1, which circumvents it for me (for now).
I tried prepare
as the way to setup Husky (cloned this repo, adjusted package.json and pushed dist directory to be able to use it as a dependency) but it looks like it breaks yarn install
in our project when it's executed on clean project checkout (no node_modules/) with empty yarn cache.
Some people suggest it's due parallel fetching + git repo as a package source + "prepare" script combination, see https://github.com/yarnpkg/yarn/issues/6312#issuecomment-422806004
If I run yarn install --network-concurrency 1
then it succeeds. So seems like "concurrency issue" is valid explanation.
Probably prepare
script will work if the package installed from the npm registry.
Describe the bug Yarn tries to run
husky install
as part ofpostinstall
script when installing this package as a dependency.To Reproduce
Expected behavior
The package being successfully installed.
Screenshots
Desktop:
Additional context
https://docs.npmjs.com/cli/v9/using-npm/scripts#npm-install
postinstall
is executed as a part of install by npm and yarn. Husky is a development dependency of this package which might not be true for project where this package is used.Now Husky project recommends to use
prepare
script to install hooks. See explanation at https://blog.typicode.com/husky-git-hooks-autoinstall/