-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not install git hooks when using yarn #84
Comments
👍 on this functionality. |
Thanks for the feedback. /tmp$ rm .git/hooks/pre-commit
rm: cannot remove '.git/hooks/pre-commit': No such file or directory
/tmp$ yarn add --dev husky
yarn add v0.17.10
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ [email protected]
Done in 0.14s.
/tmp$ cat .git/hooks/pre-commit
cat: .git/hooks/pre-commit: No such file or directory
/tmp$ yarn add --dev husky --force
yarn add v0.17.10
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Rebuilding all packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ [email protected]
Done in 0.75s.
/tmp$ cat .git/hooks/pre-commit
#!/bin/sh
# husky
cd .
... |
Can this be addressed in a future version? Projects and teams using |
Hi @avaly, Yes it will. |
I've encountered a few issues with it too :(. Had to remove the hook manually from |
I'm not experiencing this. Is it fixed? If so, close? :) |
still experiencing this |
@typicode is this still in the works? |
@erquhart did another test and |
Just faced the same problem with yarn v0.24.5, same with fresh yarn cache (i.e. after Can be reproduced on my booted. |
Hi @evenfrost, Here's what I did to test: /tmp$ mkdir A
/tmp$ cd A
/tmp/A$ git init && yarn init -y && yarn add husky --dev
Initialized empty Git repository in /private/tmp/A/.git/
yarn init v0.24.5
warning The yes flag has been set. This will automatically answer yes to all questions which may have security implications.
success Saved package.json
✨ Done in 0.07s.
yarn add v0.24.5
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Saved lockfile.
success Saved 12 new dependencies.
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
✨ Done in 0.86s.
/tmp/A$ cat .git/hooks/pre-commit
#!/bin/sh
#husky 0.13.4
# ...
/tmp/A$ cd ..
/tmp$ mkdir B
/tmp$ cd B
/tmp/B$ git init && yarn init -y && yarn add husky --dev
Initialized empty Git repository in /private/tmp/B/.git/
yarn init v0.24.5
warning The yes flag has been set. This will automatically answer yes to all questions which may have security implications.
success Saved package.json
✨ Done in 0.07s.
yarn add v0.24.5
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Saved lockfile.
success Saved 12 new dependencies.
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
✨ Done in 0.78s.
/tmp/B$ cat .git/hooks/pre-commit
#!/bin/sh
#husky 0.13.4
# ...
I was able to make /tmp$ mkdir booted-test
/tmp$ cd booted-test/
/tmp/booted-test$ git init
Initialized empty Git repository in /private/tmp/booted-test/.git/
/tmp/booted-test$ cd ..
/tmp$ ./node_modules/.bin/booted booted-test/
✔ Copying code...
✔ Installing packages with Yarn...
✔ Booted.
/tmp$ cd booted-test/
/tmp/booted-test$ cat .git/hooks/pre-commit
#!/bin/sh
#husky 0.13.3
# ... |
Hmm weird, can confirm reproducing these steps manually fixed the issue for me. Will investigate my package workflow further, thanks @typicode. |
@typicode Encountering this again. Yarn 1.9.4 To get around this and force it, I added to my package.json's scripts:
|
Same problem here using 1.13.0 and latest version of husky |
So google can find it for the next guy: husky hooks not working manually installExecute this in your command line:
|
Why is this closed? The actual issue is not solved, is still happening in:
When I try to run the above command, it fails:
Removing |
For me it was git version. I've updated git version and it worked like charm. Make sure your |
Getting the same issue as @Nikodermus here's my setup:
|
@Nikodermus Have you solved this problem? |
@Nikodermus try this method #640 (comment) |
Installing the last Yarn version (1.22.4) and running command |
using the version '3.1.0' solved my problem.
|
@cat-walk you are experiencing that issue because you are not running that command through yarn so the script cannot infer your package manager name, the error is not very explicative in this case. Try adding:
to your package json and then run: yarn run setuphusky |
At version 5 (husky@latest) and I don't get the manual install either when using |
This documents how to enable git hooks after first install: `https://typicode.github.io/husky/#/?id=install` Normally you'd simply write `husky install`, but it failed for me (see issue typicode/husky#84 (comment)), so I replaced it with the equivalent long-form invocation, `node ./node_modules/husky/lib/installer/bin install`.
This documents how to enable git hooks after first install: `https://typicode.github.io/husky/#/?id=install` Normally you'd simply write `husky install`, but it failed for me (see issue typicode/husky#84 (comment)), so I replaced it with the equivalent long-form invocation, `node ./node_modules/husky/lib/installer/bin install`.
for anyone having this issue with version 4 (which seems to also happen with INIT_CWD=.git/hooks node ./node_modules/husky/lib/installer/bin.js install to force installing the hooks under |
Just chiming in to say I'm experiencing this as well with |
I'm still having this issue:
after running I've also tried running |
The hooks won't get created for me either.
The hooks won't run, install says it's successful but it doesn't create any hooks.
But when I commit, it immediately proceeds without running anything. package.json:
|
Same issue I have. I have removed and re-added husky without any change. I have also run the install file directly, but this doesn't do anything either. My versions are as follows:
Same issues as @chenasraf . |
Turns out husky v5 does not pull hooks from In my opinion, that's worse as it pollutes the tree with another set of plain script files, which contain the command itself, instead of abstracting the command into the runner... Also husky add doesn't always |
@chenasraf Doh! Missed that, thanks for pointing it out. |
Same for us on https://github.com/decathlon/vitamin-web |
Hi, husky 5 has a breaking change regarding config, .huskyrc isn’t supported anymore. See docs for install or migration steps. |
@typicode indeed, thanks! |
Try to execute |
using |
I've spent a lot of time trying to figure out what is wrong, but the things are that they have changed the entire approach. For those who are still struggling with this issue, and for newcomers: read Husky 5 Release announcement especially sections "Optional install" and "Config":
Moreover, from the "Config" section:
dammit.. 99.9999% of existing materials described husky integration become trash.. |
Genuinely confused about the decision to remove support for config files, you could always link to your own scripts before, but now your are much more limited... |
It is not worked to me above all.
|
When running
yarn add husky --dev
, the git hooks do not get set up. I have to run the install script manually, and then it works fine.Yarn version:
0.17.9
The text was updated successfully, but these errors were encountered: