-
-
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
Husky hooks skipped #639
Comments
@Alex0007 thanks for the report. It seems that npx isn't in PATH, can you try https://docs.brew.sh/FAQ#my-mac-apps-dont-find-usrlocalbin-utilities or add this in PATH="/usr/local/bin:$PATH" |
This one worked for me |
@sholladay how was Node installed? If it was with homebrew, have you tried the suggested command? Also are you using Husky 4.0.9? |
@typicode yes, I have Node installed via Homebrew. I think I'd rather leave the (Not frustrated, per se, I just think it was the wrong decision to remove it.) |
I'm having a similar issue. Hooks run fine when git is called from the command line, but when I use Sourcetree or any other GUI not kicked off from the command line, npx can't be found in PATH. Adding it to the path at the start of each hook script solves things, but doing it in |
Switching to husky 3.1.0 (which uses run-node) also worked for me, here-- sourcetree runs the hooks, run-node finds my node installation, and commits are blocked as they should be. Still not sure how to get |
Following up in this issue... is there now a requirement to have npx in your user path? Should we add that as documentation (maybe post-npm install instructions) somewhere? Or would an option be reverting back to however 3.1.0 executed commands as that seems to be a currently working solution for people? I'm asking because I'm not sure what the expected resolution is here and if I were to open a PR I'm not sure which option to code. |
I think reverting to how 3.1.0 did this ( |
Oh sorry, this is only via GUI? I'm having this issue via command line... would you like me to create a separate issue? Or just add a comment with similar details as the initial comment? |
I would definitely say so. I mean if husky relies on npx, the OS shoud know where to find it. Extending the PATH through ~./huskyrc in the home directory works perfectly fine. Currently I am more concered, that all hooks skip & git proceeds if npx is not provided. @typicode I mean this is definitly a bug. All hooks should fail, if the project setup or OS does not provide, what is needed. |
I'm having a similar issue where it is skipping hooks because it is detecting a CI environment and thus nothing is installed Why isn't the obvious solution to allow us to install the hooks manually with some command and provide options? pre-commit does this beautifully and doesn't do magic in the install scripts and leave you hanging dead in the water cause the install didn't function because of n reasons I'd rather this was "fixed" by giving a manual trigger to install hooks instead of having to deal with the nonsense of randomly having it done during install and sometimes installing the hooks successfully |
I've experienced the same problem with |
Hi, guys. Try this workaround. |
@Chypa74 -- Yes, that is a workaround; however, due to some previous comments... I'm not sure that'll actually "fix" Sourcetree. Regardless, though, I personally feel manually "polluting" a users global environment when only a single project may be using For example, I have a team of a dozen Designers (not Developers) that are committing changes to simple Markdown files in a git repo. Unsurprisingly, not many of them are comfortable in the command line. Using Sourcetree (or any other git GUI) actually makes That being said... But, I also think GUI setups are extremely common, and |
I consider this as a serious regression for Husky. Manually creating files to workaround doesn't sound nice, as previously all just worked with single |
Similar issue, v4 no longer works with IntelliJ IDEA (commit from console does run the hook):
npx is in PATH. Downgraded to Husky 1.3.1 which works. |
The workaround worked for me. For others, (just in case as I did missed it first time), the file must be created in your home folder (~/.huskyrc) not at your project root. |
@typicode what is your take on this issue? We are bumping into this constantly with new developers introduced to the team. Previously all they have to do is This is very much inconvenient and to quite a degree diminishes everything what |
Someone should make a fork that uses run-node like the older version of |
Tested on Husky v4 vs v3 and on v4 it works with simplest configuration as said in documentation. |
It's a problem in Husky, or macOS, depending on who you choose to blame. Personally, I'm fine with macOS working the way it does by default. It's slightly better security at the cost of convenience. Husky v3 uses the |
Because of this: typicode/husky#639 Signed-off-by: Till Sanders <mail@till-sanders.de>
@typicode Since you appear to be absent from this issue for a few months – are you considering reintroducing |
@sholladay Setting up a |
If you're comfortable with that, then great, that's another option. IMO, though, duplicating dotfiles on every machine is gross. Among other problems, you'll have to keep those files in sync, which you may easily forget to do. |
If you have a project with 3rd party contributors, or a large number of internal contributors, it's not particularly feasible to ask everyone to make sure they have a The fact that this fails silently means contributors will not be made aware if they missed this step. |
Thank you, folks. I totally agree that this is weird. I hope we can back to higher version of husky someday. :D |
Hi! I have this error since macOS 10.15.7. came out
I use ports instead of brew and my npx is in /opt/local/bin/npx and I also have how can I add fix this? |
@TrejGun downgrade your Husky to version 3. |
Thanks |
Yes, scroll up in this thread. Other people have suggested various alternatives, such as using a |
was magically fixed by itself, probably after system restart |
I'm wondering why Husky is skipping in stead of failing when it can't find a command. I use nvm and I don't always have a |
For what it's worth, husky v5 fails when the pre-commit command is not found. It would be nice if the path information for mac GUIs was consistent, but at least the hook can fail when the command is not found. |
@TrejGun Same here, updated my macOS Version and noticed that the commits went through pretty fast. |
Our pre-commit hook was skipped for me when invoking git via vscode on an Ubuntu Linux box. I'm guessing it's the same problem. And it's really frustrating since the whole point of a hook is to have it be automatic and consistent. It should really fail if npx (or whatever) isn't found. It sounds like that might be the case in v5, so I hope that gets published soon. |
It was a choice before. Allow people who may not have some command(s) on their computer to not be blocked and be able to commit anyway. The idea was that the CI would catch potential errors if hook didn't run. It's obviously a trade-off. In teams, you may want to force everyone to have a command. But as @jgeurts said, unlike v4, husky v5 will block the commit if some command is not found. edit: clarification of new behaviour |
nice |
- huskyが動かなかったのでバージョンを変更 - typicode/husky#639
This does help fix VSCode...only if I open VSCode from terminal with Any ideas on why the GitHub Desktop app doesn't get fixed with this update? Still shows This should be re-opened |
husky - command not found in PATH=/c/program files (x86)/microsoft visual studio/2022/enterprise/common7/ide/commonextensions/microsoft/teamfoundation/team explorer/Git/mingw64/libexec/git-core:/c/program files (x86)/microsoft visual studio/2022/enterprise/common7/ide/commonextensions/microsoft/teamfoundation/team explorer/Git/mingw64/bin:/c/program files (x86)/microsoft visual studio/2022/enterprise/common7/ide/commonextensions/microsoft/teamfoundation/team explorer/Git/mingw64/libexec/git-core:/c/program files (x86)/microsoft visual studio/2022/enterprise/common7/ide/commonextensions/microsoft/teamfoundation/team explorer/Git/usr/bin: |
OS: MacOS 10.15.2 (19C57)
Git: git version 2.24.1
❯ which git
/usr/local/bin/git
❯ node -v
v13.5.0
❯ which node
/usr/local/bin/node
❯ which npx
/usr/local/bin/npx
Node.js installed with brew package manager
When making commit in VSCode GUI
Everything works fine when making commit from VSCode terminal.
Version 3 works fine. Sample output from v3:
The text was updated successfully, but these errors were encountered: