Unable to git commit

Viewed 9932

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)
3 Answers

This is the vendor's answer to this issue:

But if you don't want to spend time reading Husky docs, and if you are using nvm for using multiple versions of Node, every time you open a new terminal tell it which Node version you want to use. It means in the terminal of your git cli (where you "git commit ..."), do:

nvm use 12.12.12 (With your desired Node version of course)

For me, none of the solutions here worked. I had to reinstall Node.js. I didn't download it via the CLI, but rather the official site: https://nodejs.org/en/download/

Not sure if that makes a difference but that's how I downloaded & fixed it. I hope it can help someone else out too!

Related