Closed mavogel closed 3 years ago
@typicode would merging #126 be fixing this?
@mavogel thanks for the detailed issue π that's super helpful :)
I'm not getting this issue with yarn
v1.3.2
, so not sure if it's related to husky
install script. I'll have to try with yarn
v1.4.0
.
@fernandopasik https://github.com/typicode/husky/pull/126 could have but not really :)
The PR is only for picking between npm
or yarn
when running a package.json
script (for example, it would run precommit
with yarn precommit
or npm run precommit
depending on which one is installed) and wouldn't have any effect during husky installation.
Meanwhile, as a temporary workaround, you can manually run node node_modules/husky/lib/installer/bin install
or add it to your package.json
:
{
"scripts": {
"postinstall": "node node_modules/husky/lib/installer/bin install"
}
}
One word of caution, use the postinstall
hook only if you're not publishing your project on npm, else your users will get errors when trying to install your module.
@typicode FWIW I'm using v1.3.2
:
β― yarn add husky
yarn add v1.3.2
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
ββ husky@0.14.3
ββ strip-indent@2.0.0
β¨ Done in 3.00s.
β― yarn -v
1.3.2
@jasonkuhrt and it's installing nothing with v1.3.2
?
Can you try with
yarn add husky@next --dev # it should install the latest rc release
cat .git/hooks/pre-commit
I've published a new version if you want to give another try (just run yarn add husky@next --dev
).
I've moved v0.15
install script from postinstall
to install
(as it is in v0.14
).
@typicode yep now the githooks are installed, although yarn
does not log it on installing, while npm
does. Nevertheless it works now with rc7
π
$ yarn add husky@0.15.0-rc.7 -D
yarn add v1.4.0
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Saved lockfile.
success Saved 9 new dependencies.
ββ ci-info@1.1.2
ββ cosmiconfig@4.0.0
ββ husky@0.15.0-rc.7
ββ is-ci@1.1.0
ββ json-parse-better-errors@1.0.1
ββ pkg-dir@2.0.0
ββ pupa@1.0.0
ββ run-node@0.2.0
ββ slash@1.0.0
β¨ Done in 3.10s.
...
$ cat .git/hooks/pre-commit
#!/bin/sh -e
# husky
# v0.15.0-rc.7 darwin
export GIT_PARAMS="$*"
node_modules/run-node/run-node ./node_modules/husky/lib/runner/bin `basename "$0"`
how about you @jasonkuhrt ?
Fixed for me as well.
@typicode @mavogel seems good now!
I'm experiencing this with husky v3.0.1 Had to use https://github.com/typicode/husky/issues/227#issuecomment-361779926
experiencing this with husky: 3.0.9 node: 12.2.0 (via nvm) yarn: 1.19.1 yarn workspaces
yarn install husky --dev -W
βοΈ does not create the git hooks, confirmed via ls -l .git/hooks
Manually running husky's bin install script does work though https://github.com/typicode/husky/issues/227#issuecomment-361779926
Could we reopen this issue?
Same here ! Could we please re-open this issue ?
husky: 3.1.0 node: 12.10.0 (via nvm) yarn: 1.19.2 npm: 6.13.0
It does not install hooks on yarn add
but npm install
does
The behaviour I have is yarn install
does install the git hooks but
make install
(which just runs yarn install
) does not install the git hooks.
We're not using workspaces.
husky: 3.1.0 nvm: 0.35.2 node: 12.14.1 yarn: 1.21.1 npm: 6.13.4 GNU Make: 3.81
I had the same problem and I fixed it upgrading git.
Installing Husky didn't create the hooks.
I tried running the script directly:
node node_modules/husky/lib/installer/bin install
And got this:
husky > Setting up git hooks
Husky requires Git >=2.13.0. Got v2.10.2.
husky > Failed to install
I guessed that during the installation this error was hidden among all the logs and I didn't see it.
After updating git, I removed node_modules and run yarn install
again. Everything worked.
I hope this helps π
Just in case, make sure you don't have a .yarnrc (https://github.com/typicode/husky/issues/664)
Closing as workarounds/fixes seem to have been found (thanks @lmuntaner @devinrhode2) and also husky 5 should be exempt from this issue.
You may try to run npm rebuild
or yarn rebuild
to force a re-install with husky 4.
I'm currently going through this, I just updated my husky from version 4 to version 5, and then it stopped working, I deleted .git/hooks and then did git init
then yarn add husky
, nothing worked.
me too. I'm experiencing this with husky version 5
I still experience this with v7.0.4 with yarn and npm via nvm.
Do you want to request a feature or report a bug? => Bug
Installing the git hook is only triggered when
husky
is installed vianpm
but notyarn
whereas uninstalling the hooks works for both tools. Similar to #81Current Behaviour
Install
and
npm
Uninstall
and
npm
Expected Behaviour
yarn add husky@0.15.0-rc.3 -D
should also trigger the install of the git hooks.Please mention your node.js, yarn and operating system version.
OS: macOS High Sierra 10.13.3 yarn: v1.4.0 node: v9.4.0 npm: 5.6.0