-
Notifications
You must be signed in to change notification settings - Fork 220
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
Lefthook doesn't find executables with Desktop Git Client - npx: not found #887
Comments
@bennycode , do you start VSCode from terminal? It's surprising that it works without any extra configuration. Lefthook inherits envs from the environment it was called from. If it's your terminal, you usually have all envs, but with a desktop app you probably miss some Please, use Fast fix: add a rc file with the line which npx But better solution is to repeat your shell rc file adjustments. |
Hi @mrexox and thank you for your fast feedback. It helped me to narrow down the problem... I am using Windows 11 and the Windows Subsystem for Linux. My SmartGit is installed in the WSL as it supports GUI applications. There is indeed a difference in how I can start my SmartGit desktop client... Starting from Start MenuIf I run SmartGit from the Windows start menu, then the commit in combination with Lefthook fails as it cannot find
Starting from Ubuntu App (Terminal)When I initially launch my terminal using the Ubuntu app on Windows and run SmartGit ( Actually, when committing through VS Code (launched from my Start menu), the |
I see. Well, in this case I can suggest you to install lefthook via This is the first time I meet your use case and it's interesting if installation via |
How do you install I've recently added a lefthook: /usr/bin/lefthook # you may need to determine this location I hope this helps. Using lefthook with desktop tools always requires to make sure that you don't depend on your shell environment. |
🔧 Summary
When I try to push with my Git Desktop client (SmartGit) then lefthook doesn't find
npx
. If I push from within VS Code, it works.Here is my
lefthook.yml
:Lefthook version
v1.9.0
Steps to reproduce
nvm
to install and run Node.jsExpected results
Lefthook finding
npx
and other toolsActual results
Lefthook failing to find
npx
:Possible Solution
npm: not found
when using a git client and nvm #178 (comment)The text was updated successfully, but these errors were encountered: