解決方法:在pre-commit
鉤子中,加入對(duì)于PATH變量解析
文件路徑:.git/hooks/pre-commit
#!/bin/sh
PATH="/usr/local/bin:$PATH"
if [ -f $HOME/.nvm/nvm.sh ]
then
. $HOME/.nvm/nvm.sh
PATH="$HOME/.nvm/versions/node/$(nvm current)/bin:$PATH"
fi
pnpm lint-staged
原來(lái)是這樣的
#!/bin/sh
pnpm lint-staged