error: cannot spawn .git/hooks/pre-commit: No such file or directory on Windows

Author: lydemannCreated Jul 8, 2018Updated Feb 12, 2025

Hi, I'm using a windows machine. When I run standard-version I get: error: cannot spawn .git/hooks/pre-commit: No such file or directory. .git/hooks/pre-commit exists and it works if I run the standard-version git commit command manually. In my project I use Husky which makes my pre-commit hook look like this:

bash
#!/bin/sh
# husky
# v1.0.0-rc.2 win32

export HUSKY_GIT_PARAMS="$*"
node ./node_modules/husky/lib/runner/bin `basename "$0"`

Thanks.

Source: conventional-changelog/standard-version