evilmartians/lefthook

npx lefthook throwing `command not found`

luizwhite opened this issue · 3 comments

🔧 Summary

It seems after lefthook 1.6.18, when git hooks are run an error occurs with the message sh: lefthook: command not found.

Lefthook version

❯ npx lefthook version -f
sh: lefthook: command not found

Steps to reproduce

❯ npx lefthook version -f
sh: lefthook: command not found

Expected results

❯ npx lefthook@1.6.18 version -f
1.6.18 4ea200b04d374ba1bb9f66a940430309a2838d27

Actual results

❯ npx lefthook version -f
sh: lefthook: command not found

Possible Solution

No solution, since when lefthook creates git hooks, it falls in this elif:

  elif command -v npx >/dev/null 2>&1
  then
    npx lefthook "$@"

So, it is not possible in this case to set lefthook version, correct?

Logs / Screenshots

❯ LEFTHOOK_VERBOSE=true npx lefthook version -f
sh: lefthook: command not found

node/npm

❯ node --version
v20.15.1
❯ npm --version
10.8.2

Hi @mrexox !
The error persists

Screen.Recording.2024-07-18.at.07.45.32.mov

I think the fix will solve pre-installed git hooks, but new ones will throw the error above

Yes, npx lefthook is still not working for some reason. I am investigating.

I've fixed the issue with 1.7.4 release!