7

我正在与同事合作的一个项目使用 husky 版本 ^5.1.0,当我尝试推送我的提交时,我不断收到此错误。

.husky/_/husky.sh: No such file or directory

我该如何解决这个问题?

我目前正在使用 git 版本 2.18.0。

我已经提到了https://github.com/typicode/husky/issues/712https://github.com/typicode/husky/issues/242但没有太大帮助。

4

2 回答 2

5

我最终发现我必须删除 node_modules 并使用重新安装

yarn install

但这导致 .husky/_/husky.sh 被添加到我的同事不想要的提交中。

为了避免这种情况,我只需要通过自制软件更新我的 git 版本。

我刚跑

brew update && brew upgrade

brew update 命令更新 homebrew 本身,而 brew upgrade 命令更新通过 homebrew 安装的所有软件包。

我的 git 更新到 2.30.2 版本

这允许嵌套的 .gitignore 文件忽略我们项目中的 .husky/_/husky.sh 文件。

于 2021-03-15T01:56:58.363 回答
0

在我目前的情况下,我能够解决运行问题npx husky-init并丢弃它对文件所做的所有更改。

于 2022-03-01T10:10:58.967 回答