0
0

More than 1 year has passed since last update.

SourceTreeからコミットを試みるとHuskyのpre-commitでエラーになる(husky - pre-commit hook exited with code 127)

Posted at

SourceTreeからコミットを試みるとHuskyのpre-commitでエラーになる(husky - pre-commit hook exited with code 127)

Huskyでpre-commitが設定してあるプロジェクトに対し、SourceTreeからコミットを行った際、

.husky/pre-commit: line 4: yarn: command not found
husky - pre-commit hook exited with code 127 (error)

というエラーが出てコミットできませんでした。

pre-commitを確認してみると、

yarn lint

という箇所があり、 yarn が見つからないことが原因のよう

対策

open /Applications/SourceTree.app/Contents/MacOS/SourceTree

で、SourceTreeを起動することによってyarnのパスを通しています。

ただし、毎回コマンドを打ち込むのも面倒なので、

source-tree.command
#!/bin/sh
open /Applications/SourceTree.app/Contents/MacOS/SourceTree

という形でバッチファイルを作成し、権限を与え、このファイルをダブルクリックすることでSourceTreeを起動

参考サイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0