How do I resolve .husky/_/husky.sh: No such file or directory error when using husky?

Viewed 5498
2 Answers

I eventually figured out that I had to delete node_modules and reinstall using

yarn install

But this caused the .husky/_/husky.sh to be added to the commit which my colleagues did not want.

In order to avoid that I just had to update my git version via homebrew.

I just ran

brew update && brew upgrade

The brew update command updates homebrew itself, and the brew upgrade command updates all packages installed via homebrew.

My git was updated to version 2.30.2

This allows the nested .gitignore file to ignore the .husky/_/husky.sh file in our project.

In my current scenario I was able to resolve the problem running npx husky-init and discarding all the changes it made to the files.

Related