I am setting up a precommit hook on an existing electron project (on Windows) using Husky (7.0.0). To install Husky I followed the documentation (here) and the .husky folder was correctly created with the two files: husky.sh
#!/bin/sh if [ -z "$husky_skip_init" ]; then debug () { if [ "$HUSKY_DEBUG" = "1" ]; then echo "husky (debug) - $1" fi } readonly hook_name="$(basename "$0")" debug "starting $hook_name..." if [ "$HUSKY" = "0" ]; then debug "HUSKY env variable is set to 0, skipping hook" exit 0 fi if [ -f ~/.huskyrc ]; then debug "sourcing ~/.huskyrc" . ~/.huskyrc fi export readonly husky_skip_init=1 sh -e "$0" "$@" exitCode="$?" if [ $exitCode != 0 ]; then echo "husky - $hook_name hook exited with code $exitCode (error)" fi exit $exitCode fi and pre-commit:
#!/bin/sh . "$(dirname "$0")/_/husky.sh" npm test So now before commiting the test script should be run (the test script consists just in running jest, i.e. "test":"jest"). But when I run git commit (from terminal) it fails with this output: console output. The error message states that git is not able to find node, but what it looks really strange are the first two lines of the ouput, which are suggesting that jest actually run. I am using node 18.0.0 (managed via nvm-windows) and npm 7.24.2 (these two are confirmed both in windows terminal and in git bash). The path to node is already in my $PATH environment variable. Please let me know if I can add any detail