typicode / husky

Git hooks made easy 🐶 woof!
https://typicode.github.io/husky
MIT License
31.69k stars 996 forks source link

zsh throw error when use husky hooks #1411

Closed iulo closed 1 month ago

iulo commented 1 month ago

iterm2 with zsh, mac m1, husky@9.0.1

get wired error log when commit, have no idea what happend. Appreciate any help

/Users/iulo/.zshrc: line 4: ${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh: bad substitution
/Users/iulo/.zshrc: line 101: autoload: command not found
Error: Oh My Zsh can't be loaded from: sh. You need to run zsh instead.
Here's the process tree:

 PPID   PID COMMAND
    1  1702 /Applications/iTerm.app/Contents/MacOS/iTerm2
 1702  1752 /Users/iulo/Library/Application Support/iTerm2/iTermServer-3.4.23 /Use
39594 18944 git commit -m readme
18944 18945 sh .husky/_/pre-commit
 1752 39593 login -fp iulo
39593 39594 -zsh

/Users/iulo/.zshrc: line 300: compctl: command not found
/Users/iulo/.zshrc: line 354: `yarn-link-list': not a valid identifier
typicode commented 1 month ago

Hi,

What's the content of .husky/pre-commit?

iulo commented 1 month ago

@typicode just a simple echo echo "test pre-commit"

iulo commented 1 month ago

no idea why I have a . ~/.zshrc in ~/.config/husky/init.sh, remove it and everything works fine