datx icon indicating copy to clipboard operation
datx copied to clipboard

Husky hooks are not set up after yarn install

Open fvoska opened this issue 2 years ago • 2 comments

Used libraries

all

Library version(s)

2.4.6

Sample API response (if relevant)

No response

Environments with the issue

linux; node v16.17.1, npm 8.15.0, yarn 3.2.3

Environments without the issue

No response

Current behavior

Commiting after

❯ gc -m 'fix: rebuild yarn.lock to resolve yarn install issue'    
Usage Error: Couldn't find a script named "husky-run".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...

It seems like yarn install does not trigger the prepare script that husky relies on. We need a way to trigger husky prepare after yarn install.

A temporary workaround is to run npm run prepare after yarn install and after that the commit passes fine.

Seems like the current husky setup works for npm, but not for yarn. Setup should be updated according to docs: https://typicode.github.io/husky/#/?id=yarn-2

Expected behavior

Husky hooks should be set up after yarn install

Reproduction steps

1. clone repo anew
2. yarn install
3. change some file and try committing it, see husky fail

fvoska avatar Oct 14 '22 10:10 fvoska

Is this also handled in #1099 ?

DarkoKukovec avatar Oct 14 '22 12:10 DarkoKukovec

Nope, this requires changes in how husky is set up (linked docs above, but didn't have time to change the config). #1099 just regenerates lock file to fix #1097

fvoska avatar Oct 14 '22 12:10 fvoska