【问题标题】:Can't commit using husky: .husky/pre-commit: line 4: npx: command not found无法使用 husky 提交:.husky/pre-commit: line 4: npx: command not found
【发布时间】:2022-08-10 03:16:10
【问题描述】:

我已经安装了 husky,它运行了几个月,然后在重新启动后突然出现了这个错误:

husky - command not found in PATH=/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core:/usr/bin:/bin:/usr/sbin:/sbin
.husky/pre-commit: line 4: npx: command not found

我不知道是什么原因造成的,但我无法提交我的更改。显然我可以绕过这个钩子,但我想解决这个问题。

    标签: javascript npm npx husky git-husky


    【解决方案1】:

    我去搜索googs,发现运行以下命令有效:

    sudo launchctl config user path `echo $PATH`
    

    这是我从哪里得到它的来源:https://github.com/typicode/husky/issues/666#issuecomment-651919165

    其中包括解决方案来自的上下文:https://community.atlassian.com/t5/Bitbucket-questions/SourceTree-Hook-failing-because-paths-don-t-seem-to-be-set/qaq-p/274792

    【讨论】:

      猜你喜欢
      • 2021-01-04
      • 2021-07-13
      • 2019-05-22
      • 1970-01-01
      • 2021-11-27
      • 2021-03-17
      • 2022-01-07
      • 2017-01-29
      • 1970-01-01
      相关资源
      最近更新 更多