soc221b / vue-use-popperjs

[deprecated] Please use [floating-ui](https://floating-ui.com/docs/vue) instead.
https://iendeavor.github.io/vue-use-popperjs
MIT License
25 stars 3 forks source link

Run `husky install` as prepare script #221

Open anatolykazantsev opened 1 year ago

anatolykazantsev commented 1 year ago

Describe the bug Yarn tries to run husky install as part of postinstall script when installing this package as a dependency.

To Reproduce

yarn add vue-use-popperjs

Expected behavior

The package being successfully installed.

Screenshots

$ yarn add vue-use-popperjs
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/2] ⠄ vue-demi
error /app/node_modules/vue-use-popperjs: Command failed.
Exit code: 127
Command: husky install
Arguments:
Directory: /app/node_modules/vue-use-popperjs
Output:
/bin/sh: husky: not found

ERROR: 127

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/

FieldMarshallVague commented 1 year ago

I have the same issue. I downgraded and locked version to 2.3.1, which circumvents it for me (for now).

anatolykazantsev commented 1 year ago

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.