Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to git commit

Tags:

git

husky

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)
like image 989
yuturo Avatar asked Jun 23 '26 09:06

yuturo


2 Answers

npx husky-init npm install

enter image description here

npm run prepare

like image 142
ice Avatar answered Jun 25 '26 02:06

ice


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.

like image 30
Robin French Avatar answered Jun 25 '26 00:06

Robin French