-
-
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
hook fails as it assumes yarn will be available in $PATH #666
Comments
would you consider this an issue? or it is pretty much expected to have yarn available in $PATH. |
There's a similar issue when using "husky" with SourceTree.
This error can't be fixed by installing yarn globally. Any idea how to fix it? BTW - it works with earlier versions of Husky. |
Getting the same error on husky 4.2.3
Also tried Tower which is another GUI git client and same issue there. So seems like a regression since it worked out of the box with GUI git clients in previous versions. |
Does Husky really need to have locally installed Node and npm/Yarn? It makes it impossible to use with Docker, where I don't have anything in my local machine. |
Hmm, I just started running into this on VSCode. |
Having the same problem. (Why does husky need to know where the binaries are anyway? o_O) |
Killed 2 hours on trying to figure out what's wrong with Husky pre-commit hook and that |
I use this command and everything works fine again. |
I don't think downgrading solves the underlying issue. I downgraded to
both versions work fine on windows. |
@armspkt I try your command and nothing change... still work for you? What is your OSX version? I am using 10.15.7 |
I had the same problem. I'm not sure it's a nice fix, but it works for me. First
Next I add a symbol link like this:
I hope it can help |
Just for clarity, must |
Running To answer the other question, husky 4 expects that the package manager used to install is in PATH environment variable. There's a section about setting up PATH for yarn 1 As to why, it's because of this: As recommended, husky uses Hope it makes things a little clearer :) Husky 5 is a little more flexible in this regard but |
I was receiving
|
I had the same problem and with this configuration it was solved There is a section on how to set PATH if you are using a version management script like nvm https://typicode.github.io/husky/#/?id=command-not-found # ~/.huskyrc
# This loads nvm.sh and sets the correct PATH before running the hook
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" OS: macOS 10.15.7 |
Worth noting Tower has additional issues with hooks on OSX: https://www.git-tower.com/help/guides/integration/environment/mac Not their fault, but it is a PITA. I'm working on a client machine with reduced admin access because SECURITY and it's quite a drag having to rebase on the command line. |
This issue also affects the Github desktop client, FWIW. |
If you are also desperately trying to fix ".husky/pre-commit: line 4: lint-staged: command not found", add "npx lint-staged" to your pre-commit file. Read more about the solution here: https://storksnestblog.wordpress.com/2023/01/11/fixing-husky-lint-staged-command-not-found-error/ |
Wonderful, thanks a lot, you saved my time. |
husky misjudges package manager & tried to find yarn while it was upgraded using
npx yarn upgrade husky --latest
. I don't keep a global yarn & usenpx yarn ...
for all my yarn needs.Possible to let the user choose package manager?
.git/hooks/husky.sh
Instead of husky inferring which package manager it should use, would it be possible to let the user configure it for husky?
Workaround
npm install -g yarn
fixes the error.OS: macOS 10.15.3
The text was updated successfully, but these errors were encountered: