billboard.js
billboard.js copied to clipboard
husky hooks not working on windows
Description
For a while I can't commit on windows due to following error: "Commit: cannot spawn .husky/pre-commit: No such file or directory"
I was researching for a while and found out, that if I delete the hooks and recreate them manually via the console (husky add .husky\pre-push "npm run lint"
) it will add follwing 2 lines at the beginning of each hooks:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
With those 2 lines of code I am able to commit again and the hooks are working for me on windows.
@netil could you confirm, if those 2 lines of code will break anything for you on mac OS? If not it would be nice if we could add them to each hook in the repository (or maybe find another solution). Would also be interesting, if other Windows users are experiencing similar problem, when checking out the current billboard master and trying to commit anything.
My current setup
OS: Windows 10 version 10.0.19044 Build 19044 Git: version 2.41.0 node.js: 18.19.0
Also maybe the current DEVELOPMENT guide needs a refresh since it was last time updated 2 years ago, and for example the required node.js version already changed to 18+
Steps to check or reproduce
- Check out billboard repository on a Windows machine.
- Add some code and try to commit.
@michkami, thanks for the report and examination. I'm mainly doing all the jobs on MacOS, so I need to check on Windows env.
BTW, to skip the hook just add --no-verify
option
$ git commit --no-verify -m "message"
@michkami, Tested on Windows 10 Pro + Node 20 without adding shell info worked without throwing error you referred. But adding it works anyway on Mac environment, so to prevent any inconvenience will be added anyway.