You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"cygpath: command not found" when commiting to branch #10326
"cygpath: command not found" when commiting to branch
Github desktop version: 2.5.3
OS: Windows 10
Full error:
Commit failed - exit code 1 received, with output: '/c/Users/karlo/AppData/Roaming/npm/yarn: line 5: cygpath: command not found
internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module 'C:\Users\karlo\AppData\Local\GitHubDesktop\app-2.5.3\resources\app\git\node_modules\yarn\bin\yarn.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}'
Reacted by Oleg Kostin, Victor Cortez, Joao Maio, ospira, Hayden Donnelly, Anton Khmara, Longi, Mete, tallsage, Rajab Shakirov and 5 more
@zedd3v Thanks for the report. This looks like an error with your shell or path settings. Can you list your reproductions steps? What shell are you using in Desktop -- see the Options settings? And share your logs from that day? See the Help menu in Desktop for the logs.
@zedd3v As we have not heard back from you on this issue, we are closing it for now. Should you have any more details or questions, please reach out and we will be happy to help. Thank you.
So if yarn is run as part of a git hook, this will be executed in Desktop's own bundled MINGW environment, which (unlike the one bundled with Git for Windows) does not include the cygpath utility.
Reacted by Oleg Kostin, Joao Maio, J. Brandon Johnson, Dr. Derek Austin, Mete, conf2021 and Gideon Stele
So if yarn is run as part of a git hook, this will be executed in Desktop's own bundled MINGW environment, which (unlike the one bundled with Git for Windows) does not include the cygpath utility.
Is there a way to force github desktop to use the Git for Windows version instead?
@tierninho
I have the same issue.
I am using GitHub Desktop with few repositories, but issue appears only on front-end monorepo. We are using husky and yarnhook inside it, so I suppose these may cause this error. Happens on every checkout, push, merge etc. and it's pretty annoying.
We use pnpm to manage our monorepo and this husky config inside package.json: "husky": { "hooks": { "pre-push": "pnpm run prepush", "post-checkout": "yarnhook", "post-merge": "yarnhook", "post-rewrite": "yarnhook" } }
OS: Windows 10
GitHub Desktop: version up to 2.6.0
git for Windows: 2.29.2
Using git bash shell
Node: 10.23.0
npm: 6.14.8
pnpm: 5.12.0
Reacted by Victor Cortez, Joao Maio, Ralf Handl, Semih Korkmaz, zhangyan, hkuznetsovb, Dispersioned and Amit Singh
I also have been having this issue in a number of repositories. Love github desktop for visualizing commits but I have never been able to commit through the GUI.
npm global installs are in my PATH. i.e. yarn can be run in bash
very same error
Commit failed - exit code 1 received, with output: '/c/Users/ryan.guild/AppData/Roaming/npm/yarn: line 5: cygpath: command not found
internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module 'C:\Users\ryan.guild\AppData\Local\GitHubDesktop\app-2.6.0\resources\app\git\node_modules\yarn\bin\yarn.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}'
OS: Windows 10
GitHub Desktop: version up to 2.6.0
git version: 2.27.0.windows.1
Using git bash shell
Node: >=14
npm: 6.14.9
pnpm: ??? - never heard of this
@RyanGuild-TF I was actually able to make this work by manually copying the .../AppData/Roaming/npm/node_modules into the ...AppData\Local\GitHubDesktop\app-2.6.0\resources\app\git\ folder. Wish I could figure out a better way to make it work but that is what I had to resort to.
Reacted by adam-horvath, gkielwasser, tjaadvd, Leptons, Simeon Simeonov, Semih Korkmaz, Jeffery John, zhangyan, 李一绝, Codeize and 35 more
Reacted by nya, Semih Korkmaz, 李一绝, Jose Andres and hirurg-lybitel
Reacted by JJ Kim, Mete, Oana Maria Teodorescu, Jose Andres and hirurg-lybitel
Reacted by James Anderson, adam-horvath, gkielwasser, Semih Korkmaz, 李一绝, JJ Kim, Dispersioned, wongchichong, Ken aka Frosty, Mete and 6 more
Reacted by adam-horvath, gkielwasser, Sampan Verma, Semih Korkmaz, Mete, Jose Andres and hirurg-lybitel
Reacted by 李一绝, Ceazor, Ken aka Frosty, Patrick and Jose Andres
This is only happening in GitHub Desktop's bundled MINGW (but not system Git Bash), and according to @steveward, GitHub Desktop ships with an internal version of Git which, again, seems to not include the cygpath utility.
Removing this case from the script lets the configured hooks run correctly in GitHub Desktop without affecting other terminals (probably).
Looks like either GitHub Desktop's MINGW should include cygpath, or maybe yarn should not rely on this command...
I had this issue using pnpm as the package manager in one of my git repos. I added C:\Program Files\Git\usr\bin which contains cygpath.exe to my PATH environment variable, and that resolved the issue.
Reacted by Jacob Lynch, John van Keulen, Santese Smith, Dr. Derek Austin, Vissie, Nikhil Astakala, Srinivas Panuganti, Laksara, Santo Rosario, Shamik and 28 more
Reacted by Vissie, Brooke Harris, Jose Alberto Guerra Ugalde, enkri, Micovick, Justin Hedani, pisolofin, Robin payot, Nathan M., Colin Yang and 1 more
Reacted by wiktor-golonka, fischerc-utd, Brooke Harris, Shamik, ss-evoco, Micovick, Justin Hedani, pisolofin, MAHIL K R, Colin Yang and 1 more
Reacted by André Pedroso, Vincentsarsah, Justin Hedani, Wilco Waaijer, cw-ritik and Jacob Homanics
I had the same problem and it turns out it was because of a pre-commit script.
In case you're having the same problem, you can either commit from the command line while skipping the pre-commit script git commit -m "fixed something" --no-verify
or if you don't need the pre-commit script, you can delete the file YourRepository/.git/hooks/pre-commit
Reacted by Andrei I. Gere, Franciscosenestrarineoris, Chhin Sras and cw-ritik
Reacted by Oleksandr Reznichenko, Emanuel Zhupa, Davide Briscese, Alexander Ataakgayev and Gwen
Reacted by GerbetMikhaël, Kris, oğuz kağan, Nanoqoi, Ian Hattendorf and Oliver Sayers
Reacted by Sarah Peliano, Marcus, mohammad mohammadi and Franciscosenestrarineoris
I had this issue using pnpm as the package manager in one of my git repos. I added C:\Program Files\Git\usr\bin which contains cygpath.exe to my PATH environment variable, and that resolved the issue.
This caused me another problem
0 [main] cygpath (6136) C:\Program Files\Git\usr\bin\cygpath.exe: *** fatal error - cygheap base mismatch detected - 0x18034C408/0x180347408. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. internal/modules/cjs/loader.js:892 throw err; ^
@RyanGuild-TF I was actually able to make this work by manually copying the .../AppData/Roaming/npm/node_modules into the ...AppData\Local\GitHubDesktop\app-2.6.0\resources\app\git\ folder. Wish I could figure out a better way to make it work but that is what I had to resort to.
This workaround solved for me. Now the pre-commit hook can run yarn
I had this issue using pnpm as the package manager in one of my git repos. I added C:\Program Files\Git\usr\bin which contains cygpath.exe to my PATH environment variable, and that resolved the issue.
I had this issue using pnpm as the package manager in one of my git repos. I added C:\Program Files\Git\usr\bin which contains cygpath.exe to my PATH environment variable, and that resolved the issue.
I had this issue using pnpm as the package manager in one of my git repos. I added C:\Program Files\Git\usr\bin which contains cygpath.exe to my PATH environment variable, and that resolved the issue.
I had this issue using pnpm as the package manager in one of my git repos. I added C:\Program Files\Git\usr\bin which contains cygpath.exe to my PATH environment variable, and that resolved the issue.
Yes it is working. but it takes more time a single line of code! why? @meena-erian
Activity
tierninho commentedon Aug 5, 2020
@zedd3v Thanks for the report. This looks like an error with your shell or path settings. Can you list your reproductions steps? What shell are you using in Desktop -- see the Options settings? And share your logs from that day? See the Help menu in Desktop for the logs.
The
cygpathprogram is part of the Git for Windows installation. Please ensure that you have git installed from https://git-scm.com/download/win. In general you should be using the system installed Git (i.e. Git for Windows).tierninho commentedon Aug 11, 2020
@zedd3v As we have not heard back from you on this issue, we are closing it for now. Should you have any more details or questions, please reach out and we will be happy to help. Thank you.
donna-marijne commentedon Oct 20, 2020
I believe that the problem is due to the following code from yarn's bootstrap script on Windows:
So if yarn is run as part of a git hook, this will be executed in Desktop's own bundled MINGW environment, which (unlike the one bundled with Git for Windows) does not include the
cygpathutility.owenashurst commentedon Nov 6, 2020
Is there a way to force github desktop to use the Git for Windows version instead?
rletsin commentedon Nov 17, 2020
@tierninho
I have the same issue.
I am using GitHub Desktop with few repositories, but issue appears only on front-end monorepo. We are using husky and yarnhook inside it, so I suppose these may cause this error. Happens on every checkout, push, merge etc. and it's pretty annoying.
We use pnpm to manage our monorepo and this husky config inside package.json:
"husky": { "hooks": { "pre-push": "pnpm run prepush", "post-checkout": "yarnhook", "post-merge": "yarnhook", "post-rewrite": "yarnhook" } }OS: Windows 10
GitHub Desktop: version up to 2.6.0
git for Windows: 2.29.2
Using git bash shell
Node: 10.23.0
npm: 6.14.8
pnpm: 5.12.0
RyanGuild-TF commentedon Nov 30, 2020
I also have been having this issue in a number of repositories. Love github desktop for visualizing commits but I have never been able to commit through the GUI.
npm global installs are in my PATH. i.e. yarn can be run in bash
very same error
OS: Windows 10
GitHub Desktop: version up to 2.6.0
git version: 2.27.0.windows.1
Using git bash shell
Node: >=14
npm: 6.14.9
pnpm: ??? - never heard of this
Druegor commentedon Dec 18, 2020
@RyanGuild-TF I was actually able to make this work by manually copying the .../AppData/Roaming/npm/node_modules into the ...AppData\Local\GitHubDesktop\app-2.6.0\resources\app\git\ folder. Wish I could figure out a better way to make it work but that is what I had to resort to.
JMaio commentedon Dec 25, 2020
I'm having the same issue with GitHub Desktop, and can confirm @donna-marijne's reply that the issue seems to be with the yarn bootstrap script:
This is only happening in GitHub Desktop's bundled MINGW (but not system Git Bash), and according to @steveward, GitHub Desktop ships with an internal version of Git which, again, seems to not include the
cygpathutility.Removing this
casefrom the script lets the configured hooks run correctly in GitHub Desktop without affecting other terminals (probably).Looks like either GitHub Desktop's MINGW should include
cygpath, or maybe yarn should not rely on this command...My config:
(using yarn 2 with PnP)
fix(deps): upgrade husky again
mwittmann commentedon Jul 20, 2021
I had this issue using
pnpmas the package manager in one of my git repos. I addedC:\Program Files\Git\usr\binwhich containscygpath.exeto myPATHenvironment variable, and that resolved the issue.meena-erian commentedon Sep 15, 2021
I had the same problem and it turns out it was because of a pre-commit script.
In case you're having the same problem, you can either commit from the command line while skipping the pre-commit script
git commit -m "fixed something" --no-verifyor if you don't need the pre-commit script, you can delete the file
YourRepository/.git/hooks/pre-commitleopucci commentedon Sep 20, 2021
This caused me another problem
0 [main] cygpath (6136) C:\Program Files\Git\usr\bin\cygpath.exe: *** fatal error - cygheap base mismatch detected - 0x18034C408/0x180347408. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. internal/modules/cjs/loader.js:892 throw err; ^leopucci commentedon Sep 20, 2021
This workaround solved for me. Now the pre-commit hook can run yarn
7 remaining items
Geerodge commentedon Dec 6, 2022
This works, thank you. Remember to restart Git Desktop after adding to path environment variable.
octopushugger commentedon Dec 10, 2022
Still having this issue on 3.1.2. Really didn't wanna add C:\Program Files\Git\usr\bin to path but that was the only method that fixed it for me.
viniciusdalastra commentedon Jan 5, 2023
I fixed moving the cygpath.exe to "%AppData%\Local\GitHubDesktop\app-3.1.3\resources\app\git\usr\bin"
This error occurred when i updated the version.
juancolchete commentedon Jan 29, 2023
Worked for me also
rettoua commentedon Feb 10, 2023
Even though the issue is marked as closed the problem is still there. Copying node_module folder helped to solve the problem.
mason369 commentedon Mar 16, 2023
The issue still reproduces. Version 3.2.0 (x64)
SalmanTahir7 commentedon Jul 24, 2023
Reopen this issue, it still persists no matter the update, I have to apply the same fix every time I try to commit something
lunarmint commentedon Aug 3, 2023
Clean solution and worked for me, thanks!
dennis-gonzales commentedon Aug 7, 2023
I agree, the accepted solution indeed works but at the end of the day it is just a workaround and not a permanent fix.
pisolofin commentedon Sep 7, 2023
That resolve my issue in GitKraken, thanks :)
larsdouweschuitema commentedon Sep 20, 2023
Add the following line to the
.bashrcor.bash_profilefile, replacing"C:/Program Files/Git/bin"with the actual path to your Git "bin" folder:.bashror. bash_profilecan be located in your user folder"C:/Users/[name]".Make sure to reload your application. Whether that is Github Desktop, SourceTree, GitKraken or anything else.
sathish099 commentedon Nov 4, 2023
Yes it is working. but it takes more time a single line of code! why? @meena-erian
DanielYamini commentedon Nov 4, 2023
gbarros1994 commentedon Jan 24, 2024
In my case, what resolved was changing the node version
C0rn3j commentedon Nov 21, 2024
Apparently I installed the WRONG git by using
chocolatey -y git.winget install --id Git.Git -e --source wingetresolved it.