-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
husky - pre-commit hook exited with code 3 (error) #1176
Comments
Make sure you have permissions in all your folders / files from administrator profile- this solved it for me |
我也遇到了,修改项目文件操作权限并不解决这个问题 |
Try adding So make it look like: |
we had this issue on one of my colleagues and it turned out it was a minor version difference for node. Specifically he was running node 16.17 and the .nvmrc file for the project specified 16.13. So we installed 16.13 on his computer, changed to using that version and problem solved! Specific Steps:
Hopefully that will solve it! Step 3 may not even be necessary as it should automatically set the version of node to the version shown in |
Hi, thanks all for your suggestions. What ended up working for me was to remove 2 lines from my pre-commit file:
|
Hello,
I have an issue with husky and the pre-commits on a project. I have husky set up on other projects and it is working. On this specific project I can not commit anymore but my colleagues can. No matter the commit, even empty, I have this error:
husky - pre-commit hook exited with code 3 (error)
I have tried a bunch of things, and deleting the node_modules, husky.sh and .git/hooks and trying to find information on the error code 3 online but could not find anything. Would you know what code 3 matches to please?
I have the version 8.0.1 in a node project, using yarn.
The pre-commit file:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
npx lint-staged
In the package.json I have the ling-staged:
"lint-staged": { "**/*": "yarn prettier --write --ignore-unknown" }
The husky.sh file:
#!/usr/bin/env 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
readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"
if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi
if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi
exit $exitCode
fi
Thanks for your help!
The text was updated successfully, but these errors were encountered: