When I commit, I get the following husky error.
I ran npx --version to see if npx was installed.
It showed 8.0.0.
After running rm -rf .husky, I did another git commit, but it didn't solve the problem.
error
.husky/pre-commit: line 4: npx: command not found
husky - pre-commit hook exited with code 127 (error)
npx husky-init npm install

npm run prepare
For me this is caused by missing Git path in Advanced System Settings > Environment Variables > System Variables > Path
The missing value is one of
C:\Program Files\Git\cmd
C:\Program Files\Git\bin
Add this and then restart your Git environment. This is from a comment at the bottom of this thread https://github.com/typicode/husky/issues/1038
This happens to me in Visual Studio, usually after an update this is missing and needs to be re-added.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With