解决方法:在pre-commit
钩子中,加入对于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
原来是这样的
#!/bin/sh
pnpm lint-staged