1
0

More than 1 year has passed since last update.

[SourceTree] pre-commit hookエラー(husky - pre-commit hook exited with code 127)

Posted at

はじめに

M1 MacでSourceTreeを使っていた際に下記のエラーが発生したので、それの解決方法
go言語のプロジェクトではなく、TypeScriptVue.jsのプロジェクトで起こった。

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

このエラーメッセージは、npxコマンドが見つからないためにpre-commitフックが失敗したことを示しているが、npx -vでインストールされていることは確認している。おそらくanyenvで入れてる下記が悪さをしていそう。
でも、チームで決めたこのバージョンは変更できない。

.anyenv/envs/nodenv/versions/16.15.0/bin/npx

一旦の解決方法

SourceTreeのContentsの中にあるSourceTreeをターミナルから再起動することで解決した。
起動すると、もう一つターミナルが立ち上がるが一旦そのままにしている。

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

これでCommit、Pushまで出来たことを確認できた。

1
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
1
0