fix: resolve MINGW64 double-path conversion in install.sh#1015
Conversation
On Git Bash (MINGW64), the native Windows Node.js binary receives a POSIX path from $SCRIPT_DIR (e.g. /g/projects/everything-claude-code) which Git Bash auto-converts to G:\g\projects\... — doubling the drive letter prefix and producing MODULE_NOT_FOUND errors. Fix: use `cygpath -w` when available to explicitly convert the POSIX path to a proper Windows path before passing it to Node, falling back to the original path on non-MSYS/Cygwin environments.
📝 WalkthroughWalkthroughModified Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes install.sh failing on Windows Git Bash (MINGW64) due to MSYS path auto-conversion producing an invalid “double-prefixed” path when invoking the Node-based installer.
Changes:
- Detects
cygpathand converts the Node script path to a proper Win32 path before invokingnode. - Falls back to the original POSIX path behavior on non-MSYS environments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR fixes a Windows/Git Bash (MINGW64) compatibility issue in Key changes:
Confidence Score: 5/5Safe to merge — targeted, well-guarded fix with zero impact on Linux/macOS behavior. The change is a single conditional block with a narrow, well-understood scope. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[install.sh starts] --> B[Resolve symlinks → SCRIPT_DIR\nPOSIX path e.g. /g/projects/ecc]
B --> C{node_modules present?}
C -- No --> D[npm install]
C -- Yes --> E{cygpath available?}
D --> E
E -- Yes MSYS2/Git Bash --> F["cygpath -w converts to G:\\projects\\...\\install-apply.js"]
E -- No Linux/macOS --> G[NODE_SCRIPT = POSIX path unchanged]
F --> H[exec node NODE_SCRIPT args]
G --> H
Reviews (1): Last reviewed commit: "fix: resolve MINGW64 double-path convers..." | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
install.sh (1)
32-32: Implementation is correct; consider potential edge case with path arguments.The main fix works well. One optional consideration: if users pass file paths as arguments (e.g.,
--configPath /some/path), those could also be subject to MSYS2's path conversion. However, this is a lower-priority edge case since:
- Most users use default config discovery (no explicit paths)
- The current fix addresses the critical blocking issue
If this becomes a reported problem later, the arguments could be preprocessed similarly.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@install.sh` at line 32, Optional edge case: prevent MSYS2 path conversion for user-supplied path args when calling exec node "$NODE_SCRIPT" "$@". Fix by either exporting MSYS_NO_PATHCONV=1 (or setting MSYS2_ARG_CONV_EXCL to exclude path-like patterns) immediately before the exec line, or by preprocessing the "$@" array to detect known path flags (e.g., --configPath, --config, --path) and normalize/escape them (or convert with cygpath) before passing to NODE_SCRIPT; update the code around the exec node "$NODE_SCRIPT" "$@" invocation to implement one of these approaches.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@install.sh`:
- Line 32: Optional edge case: prevent MSYS2 path conversion for user-supplied
path args when calling exec node "$NODE_SCRIPT" "$@". Fix by either exporting
MSYS_NO_PATHCONV=1 (or setting MSYS2_ARG_CONV_EXCL to exclude path-like
patterns) immediately before the exec line, or by preprocessing the "$@" array
to detect known path flags (e.g., --configPath, --config, --path) and
normalize/escape them (or convert with cygpath) before passing to NODE_SCRIPT;
update the code around the exec node "$NODE_SCRIPT" "$@" invocation to implement
one of these approaches.
) On Git Bash (MINGW64), the native Windows Node.js binary receives a POSIX path from $SCRIPT_DIR (e.g. /g/projects/everything-claude-code) which Git Bash auto-converts to G:\g\projects\... — doubling the drive letter prefix and producing MODULE_NOT_FOUND errors. Fix: use `cygpath -w` when available to explicitly convert the POSIX path to a proper Windows path before passing it to Node, falling back to the original path on non-MSYS/Cygwin environments.
) On Git Bash (MINGW64), the native Windows Node.js binary receives a POSIX path from $SCRIPT_DIR (e.g. /g/projects/everything-claude-code) which Git Bash auto-converts to G:\g\projects\... — doubling the drive letter prefix and producing MODULE_NOT_FOUND errors. Fix: use `cygpath -w` when available to explicitly convert the POSIX path to a proper Windows path before passing it to Node, falling back to the original path on non-MSYS/Cygwin environments.
Closes #1016
Problem
On Windows with Git Bash (MINGW64),
./install.sh --profile fullfails immediately:Root Cause
install.shcomputesSCRIPT_DIRviapwd, which returns a POSIX-style path (e.g./g/projects/everything-claude-code). This is then passed directly to Node.js, which on Windows is a native Win32 binary. Git Bash's automatic POSIX→Windows path conversion converts/g/projects/...→G:\g\projects\...— doubling the drive prefix — resulting in an invalid path that Node.js cannot resolve.Fix
Use
cygpath -w(available in all MSYS2/Cygwin environments including Git Bash) to explicitly convert the POSIX path to a proper Windows path before it reaches Node.js. Falls back gracefully to the original value on Linux/macOS wherecygpathis not present.Verification
Tested and confirmed working on Windows 11, Git Bash (MINGW64), Node.js v22.22.0 —
./install.sh --profile fullcompletes successfully, processing all 597 file operations.