Ant-design-pro: hooks无法执行pre-commit

Created on 12 Aug 2019  ·  4Comments  ·  Source: ant-design/ant-design-pro

新构建的项目,hooks无法执行pre-commit

在npm run lint-staged检测报错的情况下,git commit没有执行pre-commit钩子,直接提交成功。
应该是在lint-staged检测报错的情况下,commit也会报错。

设备条件:mac系统,create umi最新版本。

image

Most helpful comment

看到以下内容应该就好了
image

All 4 comments

可以查看 .git/hooks/pre-commit 文件验证hook是否存在。不存在的话可以重新安装husky
cnpm install husky

看到以下内容应该就好了
image

image
谢谢。找到原因了,husky要求git版本在2.13.0以上,git版本过低会导致husky设置git hooks失败,上图为报错信息。
解决方法:升级git版本,重新执行cnpm install husky。
image

卸载husky,把yarn.lock或者package.json.lock删掉

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RichardStark picture RichardStark  ·  3Comments

Yoping picture Yoping  ·  3Comments

zhongjiewu picture zhongjiewu  ·  3Comments

skyFi picture skyFi  ·  3Comments

yjz1004 picture yjz1004  ·  3Comments