-
-
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
Precommit hook fails inside Visual Studio 2019 #673
Comments
same issue here |
same issue but for GitHub Desktop for Windows |
I also have this issue. As suggested, downgrading Husky to 3.1.0 appears to fix it |
Also having this issue with GitHub Desktop. A few of our staff use GitHub Desktop, hopefully this issue gets fixed. 3.1.0 is quite old. |
…added - Removed save flag in `npm i --save aesthetically` . [Redundant](https://stackoverflow.com/questions/19578796/what-is-the-save-option-for-npm-install) - Removed default failing test - Code formatting with [Prettier] (https://prettier.io) added. Rules added in package.json. Pre-commit hook added with husky (to format code). Latest version not used because of an [issue](typicode/husky#673) with GitHub desktop.
This seems similar to https://stackoverflow.com/questions/61196309/husky-4-x-not-working-with-visual-studio-git, maybe try the solution from that link. |
Thanks for the link, this worked for me: "scripts": {
"format-staged": "pretty-quick --staged"
},
"husky": {
"hooks": {
"pre-commit": "npm run format-staged"
}
} |
Try |
This is not specific to Visual Studio. |
i have this issue on GitHub Desktop. it appears to be specific to removing this from my
the error log gives a small indication of what's happening. it incorrectly looks in:
where the real path is:
error log:
|
@lloydtao Were you able to find a workaround solution? |
Hi! A brute solution is removing whatever hook (e.g. |
Well, I actually do this. Other people use Husky in their projects, and when I want to contribute to their projects, I get rid of the hooks first so I can commit a change! 🙄 You can also remove the |
Not sure but it seems to be a PATH issue. Could you try logging PATH? In echo "$PATH" > PATH.txt |
@BarakMaozCIQ you have some workarounds posted above. You can change the script to be run on precommit with |
It's a visual studio issue, in the included git version the cygpath.exe is missing. https://developercommunity.visualstudio.com/t/Missing-cygpathexe-in-git/1393876 |
It is actually a Husky problem. I had the issue with GitHub Desktop, not Visual Studio. Husky v1 works fine for example. |
Nope, it's a problem of the used git distribution. cygpath seems also be missing in github desktop. The included bash sets MSYS env, which causes the npm shell wrapper to use cygpath. |
committing on my terminal works fine. Committing on GitHub Desktop results in Error:
Followed the guide here: https://github.com/okonet/lint-staged#installation-and-setup
|
@viceice Microsoft has closed your issue meaning this is a Husky issue and it should be fixed independently of the environment that Husky is being used in (Visual Studio, GitHub Desktop, Atom, etc). https://developercommunity.visualstudio.com/t/Missing-cygpathexe-in-git/1393876#T-N1414158
|
@aminya i know 😕 for me it looks like a npm issue too, because the generated shell wrapper scripts are not checking the existence of cygpath. |
Husky directly spawns husky/packages/husky/src/index.ts Line 11 in a66271d
async function getGitExe() {
if ("win32" !== process.platform) {
return "git"
}
const which = await import('which')
let gitPaths = await which('git', { all: true })
gitPaths = gitPaths.filter(gitPath => /* some condition */)
if (gitPaths.length === 0) {
return "git" // or throw an error
}
return gitPaths[0]
} |
Any update on this? |
Hello everyone, I had the same error in Github Desktop and fix it by downgrading to a lower version of Git for Windows:
|
I had this issue on an Angular project. It happened running I'm using nvm-for-windows using Nodejs 14.17.0 and npm 6.14.13. |
Those who still have this issue. I migrated to |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Look here, this fixed these issue for me: yarnpkg/berry#4095 |
Hi,
I have
git version 2.24.1.windows.2
,husky 4.2.3
,VS2019 16.4.5
,pretty-quick 2.0.1
andhusky
fails to run insideVS2019
only with the following message:But it works perfectly fine from
git bash
and other git clients like SourceTree and Tortoise. I'm not sure how can I runhusky
in debug mode from VS so I can provide you with the debug log. Withhusky 3.1.0
it works just fine. Please let me know if you need more info. Thank you :)The text was updated successfully, but these errors were encountered: