-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command "husky-run" not found. #854
Comments
Can confirm. This is so ridiculously annoying. Here is my solution |
Hi @budarin, Could you provide steps to reproduce the issue? Also are you using Git 2.9+? |
git version 2.30.0 (2.30.0.windows.2) steps to reproduce - upgrade husky to the latest ver. |
Git version: 2.30.0.windows.2, if this is required for git 2.9+ then there needs to be support for older versions |
Hmm, can't try right now on Windows. But here are the steps I've done and it seems to work. Let me know if I'm missing something. /tmp/foo main
❯ git init
Initialized empty Git repository in /tmp/foo/.git/
/tmp/foo main*
❯ npm init -y
Wrote to /tmp/foo/package.json:
{
"name": "foo",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"husky": "^4.3.8"
},
"dependencies": {},
"description": ""
}
/tmp/foo main*
❯ npm install husky@4 -D
> husky@4.3.8 preuninstall /tmp/foo/node_modules/husky
> node husky uninstall
husky > Uninstalling git hooks
husky > Done
> husky@4.3.8 install /tmp/foo/node_modules/husky
> node husky install
husky > Setting up git hooks
husky > Done
> husky@4.3.8 postinstall /tmp/foo/node_modules/husky
> opencollective-postinstall || exit 0
Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate
npm WARN foo@1.0.0 No description
npm WARN foo@1.0.0 No repository field.
+ husky@4.3.8
updated 1 package and audited 47 packages in 1.883s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
/tmp/foo main*
❯ npm install husky@5 -D
> husky@4.3.8 preuninstall /tmp/foo/node_modules/husky
> node husky uninstall
husky > Uninstalling git hooks
husky > Done
npm WARN foo@1.0.0 No description
npm WARN foo@1.0.0 No repository field.
+ husky@5.0.9
removed 46 packages, updated 1 package and audited 1 package in 0.67s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
/tmp/foo main*
❯ npx husky install
husky - Git hooks installed
/tmp/foo main*
❯ npx husky add .husky/pre-commit "echo hello && exit 1"
created .husky/pre-commit
/tmp/foo main*
❯ git add package.json
/tmp/foo main*
❯ git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
hello
husky - pre-commit hook exited with code 1 (error) |
^ After downgrading and building again, it just, doesn't work. I've got an idea but a faint one. |
Alright, figured out how to fix it. Firstly, we need to remove .git/hooks. For me, I ran typicodes husky-4-to-5, which worked like a charm. Then, run yarn / npx husky install. Viola, should work. You can check out my repo to check out how I did it. Some additional resources: #!/bin/sh
. "$(dirname "$0")/_/husky.sh"
echo '$ commit-msg'
echo '$ yarn commitlint -e $1'
yarn commitlint -e $1 Have a great day. 👋 Leave me a comment if this helped you out! |
Thanks, @Milo123459 your suggestion works like a charm 🙌 |
Glad it does 😉 |
it did not help me :( |
What's happened meaning it didn't work? |
there were no errors - hooks folder had not been created with husky |
Try, npx husky install. |
Try |
but my previous hooks are lost!!! :( |
Firstly, don't close this issue, it'll be helpful for other users. |
Did you run husky 4 to 5? |
they are in package.json but not used with husky in commit process |
yarn husky add .husky/hook-name "script to run" |
23 verbose stack Error: could not determine executable to run
23 verbose stack at getBinFromManifest (C:\Program Files\nodejs\node_modules\npm\lib\exec.js:264:23)
23 verbose stack at exec (C:\Program Files\nodejs\node_modules\npm\lib\exec.js:178:15)
24 verbose cwd C:\Users\Мастер\AppData\Local\npm-cache\_cacache\tmp\git-clone-bc12e66d |
I used to use huskyrc.js - now it's useless? |
Yes. |
I node version? |
v15.8.0 |
Never mind on that, just convert everything to .husky/hook |
do then try to commit - got the error: > git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
.husky/pre-commit: line 4: lint-staged: command not found
husky - pre-commit hook exited with code 127 (error) |
Replace lint-staged with yarn lint-staged |
@PaulMEdwards yup, using |
There probably is a way to isolate the sh files like package.json scripts, but it'll have to work for pnpm and yarn v2 which is a pain. |
Can confirm that the latest version of 5.x is broken again with |
pnpx. Use pnpx. |
@Milo123459 that's a workaround, not a solution. I'd expect husky to behave the same on install between 4.x and 5.x. As it is, it's broken. |
It's not pnpms fault. It's husky's. The script just has to be isolated like the npm scripts are. I'm sure there is a way to do that. Also, at least it works, better then nothing! 😅 |
We're on the same page there, saying the same thing in different ways 👍 |
issue 854 in husky repo: typicode/husky#854
Well, this does not work for me, hooks are not working now.
Indeed it is. |
@SalahAdDin try |
I solved it by the GitKraken related issue. |
@SalahAdDin Can you post that issue here and your fix? |
To fix With yarn:
With pnpm:
It will set up hooks and create a pre-commit hook that you can edit in Optionally, you can delete There's also section for migrating from husky 4 to 5 in the docs: Hope this helps :) |
Issue and fix: #875 |
Electron v12 introduced a breaking change, so we need to set contextIsolation to false for our app to continue to work. Also update husky to fix husky-run command not found, as seen in typicode/husky/issues/854, and lint-staged not found, in typicode/husky/issues/618 and prettier config change https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21
@typicode running
You closed this issue with bad info. |
That looks like husky6, this issue covered husky 5.. |
No way, Husky 6? |
package.json |
I found this very helpful for mac osX - https://dev.to/studiospindle/using-husky-s-pre-commit-hook-with-a-gui-21ch |
Just have upgraded from v4.3.8 to v5.0.9 and got the error
have tried to uninstall/install husky, remove
npde_modules
- nothing helpedThe text was updated successfully, but these errors were encountered: