typicode / husky

Git hooks made easy 🐶 woof!
https://typicode.github.io/husky
MIT License
32.68k stars 1.03k forks source link

Husky 9 - cannot execute binary file #1426

Open pabloimrik17 opened 7 months ago

pabloimrik17 commented 7 months ago

Troubleshoot

If you're migrating from husky 4, see: https://typicode.github.io/husky/migrate-from-v4.html

Context Please describe your issue and provide some context: Fresh install with pnpm 8 and husky 9.

Just created the basic pre-commit hook from the docs (npm test) and when the hook runs i get this error

.husky/pre-commit: .husky/pre-commit: cannot execute binary file husky - pre-commit script failed (code 126)

MartinX3 commented 6 months ago

It suddenly happens to me since today. I didn't change the computer.

I only made the following system updates on my arch linux laptop with btrfs and restarted my pc:

[2024-05-18T14:20:42+0200] [ALPM] upgraded linux-zen-headers (6.8.9.zen1-2.1 -> 6.9.1.zen1-1.1)
[2024-05-18T14:20:39+0200] [ALPM] upgraded linux-zen (6.8.9.zen1-2.1 -> 6.9.1.zen1-1.1)
[2024-05-18T14:20:37+0200] [ALPM] upgraded libdatachannel (0.21.0-1.1 -> 0.21.1-1.1)
[2024-05-18T14:20:37+0200] [ALPM] upgraded libjuice (1.4.1-1.1 -> 1.4.2-1.1)
[2024-05-18T14:20:37+0200] [ALPM] upgraded bluez-utils (5.75-1 -> 5.76-1)
[2024-05-18T14:20:37+0200] [ALPM] upgraded bluez-libs (5.75-1 -> 5.76-1)
[2024-05-18T14:20:37+0200] [ALPM] upgraded bluez (5.75-1 -> 5.76-1)

So maybe it has something to do with the 6.9.1 kernel.

It only happens with pnpm install. With pnpm run prepare or executing husky directly it works.

HayateTsuki commented 5 months ago

Troubleshoot

If you're migrating from husky 4, see: https://typicode.github.io/husky/migrate-from-v4.html

Context Please describe your issue and provide some context: Fresh install with pnpm 8 and husky 9.

Just created the basic pre-commit hook from the docs (npm test) and when the hook runs i get this error

.husky/pre-commit: .husky/pre-commit: cannot execute binary file husky - pre-commit script failed (code 126)

I have the same problem. After hit git commit -m "testing pre-commit code" got error

.husky/pre-commit: .husky/pre-commit: cannot execute binary file husky - pre-commit script failed (code 126)

Resolved that after change pre-commit file encoding from UTF-16 (as it is as default after initializing husky) to UTF-8. I have done this in VS Code.

OlqSCki1 Screenshot_1

Regards!

MartinX3 commented 5 months ago

It got fixed in the 6.9.x kernel I think. It works now.