You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@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 PATH adjustments.
Please, use rc option if you use some desktop app with lefthook (you can put it to lefthook-local.yml, see examples)
Fast fix: add a rc file with the line export PATH=$PATH:<path where npx lives>
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 Menu
If I run SmartGit from the Windows start menu, then the commit in combination with Lefthook fails as it cannot find npx:
sh: 1: npx: not found
Starting from Ubuntu App (Terminal)
When I initially launch my terminal using the Ubuntu app on Windows and run SmartGit (~/smartgit/bin/smartgit.sh), I don't encounter any issues with Lefthook. However, it seems that Lefthook is not executed at all on a pre-commit.
Actually, when committing through VS Code (launched from my Start menu), the pre-commit hook is not executed either.
🔧 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: