DEV Community 👩‍💻👨‍💻

jeancatarina
jeancatarina

Posted on

fatal: cannot run .husky/pre-commit: No such file or directory

Error:

fatal: cannot run .husky No such file or directory

Best Solution

  • copy the content of the file (pre-commit) Image description
  • delete the file with error (pre-commit)
  • npx husky add ./.husky/pre-commit
  • open the file and paste the content
  • now will work

Another solutions

1- rm -rf node_modules && rm -rf yarn.lock && yarn install
2- chmod +x ./.husky/*
3- rm -rf .git/hooks/pre-commit

Top comments (2)

Collapse
 
amitbeck profile image
Amit Beckenstein

Thanks!!!

Collapse
 
carstingaxion profile image
Carsten Bach

Helped me too. Thanks for sharing.

🤔 Did you know?

✍️ Writing your own article is easy (we even support markdown)