Pre-commit hook error: "npx: not found" when trying to commit through VS Code

29 views Asked by At

When attempting to commit changes to GitHub through VS Code, I encounter the following error message in the output:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
.husky/pre-commit: 4: npx: not found
husky - pre-commit hook exited with code 127 (error)


I have tried to commit changes using VS Code's integrated Git functionality, but I keep getting this error related to the npx command not being found. I expected the commit to proceed smoothly without any errors.

Additionally, here is the relevant information from my git log output:


2024-03-13 20:52:09.492 [info] > git cat-file -s 580bb1264ec286e85d7c05fbbed7a73fd8ca0e13 [5ms]
2024-03-13 20:52:11.181 [info] > git ls-tree -l HEAD -- /home/lalith/brmaStr/mobile/qkmobile/src/app/service-request/your-requests/your-requests.component.ts [43ms]
2024-03-13 20:52:11.184 [info] > git ls-files --stage -- /home/lalith/brmaStr/mobile/qkmobile/src/app/service-request/your-requests/your-requests.component.ts [5ms]
2024-03-13 20:52:11.237 [info] > git cat-file -s 580bb1264ec286e85d7c05fbbed7a73fd8ca0e13 [4ms]
2024-03-13 20:57:19.269 [info] > git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - [12ms]
2024-03-13 20:57:19.270 [info] .husky/pre-commit: 4: npx: not found
husky - pre-commit hook exited with code 127 (error)
2024-03-13 20:57:19.310 [info] > git config --get-all user.name [3ms]
2024-03-13 20:57:19.355 [info] > git config --get-all user.email [3ms]
2024-03-13 20:57:19.409 [info] > git config --get commit.template [4ms]
2024-03-13 20:57:19.455 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/main_queueEntryFix refs/remotes/main_queueEntryFix [2ms]
2024-03-13 20:57:19.505 [info] > git status -z -uall [9ms]

0

There are 0 answers