husky回退版本到v4仍然不生效
近期新建 vue 项目的时候,想要照着老项目装一下 husky,装了以后发现使用方法和老项目的不一样,感觉不很适应,因此想着卸载重装低版本的。结果咋重装都没用,跟 husky 死了一样。
husky 从 v5 以后使用 .husky 文件夹配置 git hooks,而不再使用 package.json 或者 .huskyrc.js 等配置
首先卸载重装的方法是
| 1 | npm uninstall husky | 
这时候会发现虽然已经重装了 husky,但是仍然没有生效,解决方法如下:
| 1 | rm -rf .husky && git config --unset core.hooksPath | 
参考自 github issus
其实官网上有,〒▽〒,官方 github 文档上也有,只是一开始没看到┓(;´_`)┏
最后说明一下原因,husky 从v5之后更改了 git 的 core.hooksPath 这一配置,导致重装低版本的 husky 仍然失效
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Mosu!
 评论
ArtalkGitalk

 Mosu is located on the shore of Mosu Lake, facing the vast Chu Sea, backed by the Yihan Mountains. Thousands of miles of Mosu Desert can not erode the Mosu Valley. Thus the Mosu Empire was established.
 Mosu is located on the shore of Mosu Lake, facing the vast Chu Sea, backed by the Yihan Mountains. Thousands of miles of Mosu Desert can not erode the Mosu Valley. Thus the Mosu Empire was established.


