git提交报错: .husky/pre-commit: line 4: npx: command not found

318 阅读1分钟

问题讨论如下:github.com/typicode/hu… 如果使用nvm安装的node会在使用vscode的UI页面提交git文件的时候报错

解决方案:

typicode.github.io/husky/#/?id…

在终端输入,然后执行

code ~/.huskyrc

粘贴下面的内容到: ~/.huskyrc

# This loads nvm.sh and sets the correct PATH before running hook
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

保存文件,然后使之生效

source ~/.huskyrc

问题解决!