desktop: Windows 10 - cygpath: command not found
Describe the bug
When attempting to commit or push a branch I am given an error about cygpath not being found.
Git For Windows is installed on my system and running the commands manually in a command prompt works fine. GitHub desktop preferences has the shell set to Command Prompt also which I would have thought would solve the issue, but it does not. Changing it to Git Bash also does not appear to have any effect.
Version & OS
Version 2.5.7 Windows 10 Pro - 10.0.18363 Build 18363
Steps to reproduce the behavior
- Make a commit on a project that uses pre-commit hooks using husky.
- Observe the error message
OR
- Create a branch on a project that uses pre-commit hooks using husky
- Push the branch
- Observe the error message
Expected behavior
Should commit and run the pre-commit hooks.
Actual behavior
Throws the following error;
/c/dev/work/SomeProject/node_modules/.bin/npm: line 5: cygpath: command not found
internal/modules/cjs/loader.js:985
throw err;
^
Error: Cannot find module 'C:\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
error: failed to push some refs to 'https://github.com/SomeUser/SomeProject.git'
Logs
2020-11-09T11:33:23.145Z - info: [ui] Executing createCommit: git commit -F - (took 1.401s)
2020-11-09T11:33:23.149Z - error: [ui] `git commit -F -` exited with an unexpected code: 1.
stderr:
husky > pre-commit (node v12.16.1)
/c/dev/work/SomeProject/node_modules/.bin/lint-staged: line 5: cygpath: command not found
internal/modules/cjs/loader.js:985
throw err;
^
Error: Cannot find module 'C:\lint-staged\bin\lint-staged.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 15 (2 by maintainers)
Commits related to this issue
- Sanitize pre-commit rush invocation Directly invoking `rush` can be troublesome on Windows because the git-bash wrapper script for `rush` can be invoked in barebones environments. See: https://githu... — committed to Azure/communication-ui-library by prprabhu-ms 3 years ago
- Sanitize pre-commit rush invocation Directly invoking `rush` can be troublesome on Windows because the git-bash wrapper script for `rush` can be invoked in barebones environments. See: https://githu... — committed to Azure/communication-ui-library by prprabhu-ms 3 years ago
- Sanitize pre-commit rush invocation (#152) Directly invoking `rush` can be troublesome on Windows because the git-bash wrapper script for `rush` can be invoked in barebones environments. See: http... — committed to Azure/communication-ui-library by prprabhu-ms 3 years ago
I fixed this by installing the latest Git for Windows, then copying
C:\Program Files\Git\usr\bin\cygpath.exe
to%HOMEPATH%\AppData\Local\GitHubDesktop\app-2.9.0\resources\app\git\usr\bin
.Not elegant, but it showed only one command was missing.
@pmachapman Thanks, that worked perfectly!
@pmachapman it worked. Thanks
@pmachapman it worked. Thanks
@pmachapman not elegant,but the only way and worked , thanks
Hi Steve,
Yes I tried both solutions but none of them worked. As i said before, if I run the git commands manually for committing and pushing, it works fine. I also have two other computers running Windows 10 that somehow work in Github Desktop also that are no different than my current computer both work fine using the exact same project. If I run
git --exec-path
on all machines, they all return the same path too.@owenashurst unfortunately this is a specific issue with the configuration of your pre-commit hook script so there isn’t much we can do on our end. Did you try running the
git config stash.usebuiltin false
command to see if that worked?