Skip to content

fix: resolve MINGW64 double-path conversion in install.sh#1015

Merged
affaan-m merged 1 commit into
affaan-m:mainfrom
mike-batrakov:fix/install-sh-mingw64-path-conversion
Mar 30, 2026
Merged

fix: resolve MINGW64 double-path conversion in install.sh#1015
affaan-m merged 1 commit into
affaan-m:mainfrom
mike-batrakov:fix/install-sh-mingw64-path-conversion

Conversation

@mike-batrakov

@mike-batrakov mike-batrakov commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Closes #1016

Problem

On Windows with Git Bash (MINGW64), ./install.sh --profile full fails immediately:

Error: Cannot find module 'G:\g\projects\everything-claude-code\scripts\install-apply.js'
    ...
  code: 'MODULE_NOT_FOUND',

Root Cause

install.sh computes SCRIPT_DIR via pwd, 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 where cygpath is not present.

if command -v cygpath &>/dev/null; then
    NODE_SCRIPT="$(cygpath -w "$SCRIPT_DIR/scripts/install-apply.js")"
else
    NODE_SCRIPT="$SCRIPT_DIR/scripts/install-apply.js"
fi

exec node "$NODE_SCRIPT" "$@"

Verification

Tested and confirmed working on Windows 11, Git Bash (MINGW64), Node.js v22.22.0 — ./install.sh --profile full completes successfully, processing all 597 file operations.

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.
Copilot AI review requested due to automatic review settings March 30, 2026 01:49
@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Modified install.sh to add MSYS2/Git Bash compatibility by conditionally converting the POSIX script path to Windows format using cygpath -w when available, and passing the computed path variable to the node invocation instead of hardcoding the path.

Changes

Cohort / File(s) Summary
MSYS2/Git Bash Path Compatibility
install.sh
Added conditional cygpath check to convert POSIX path to Windows-compatible format, storing result in $NODE_SCRIPT variable for use in node invocation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • PR #532: Modifies platform-specific installer wrapper behavior to ensure Node is invoked with Windows-compatible paths to scripts/install-apply.js.
  • PR #415: Addresses the same Windows POSIX-to-Windows path translation issue by avoiding bash-emitted POSIX paths in Node/test invocations.

Poem

🐰 A shell script learns to speak both tongues,
POSIX to Windows, paths get sung,
With cygpath checks so neat and bright,
Git Bash hops now left and right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing a MINGW64 double-path conversion issue in install.sh, which directly matches the changeset's purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 cygpath and converts the Node script path to a proper Win32 path before invoking node.
  • 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-apps

greptile-apps Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a Windows/Git Bash (MINGW64) compatibility issue in install.sh where the POSIX-style path produced by pwd was being mangled into an invalid Windows path when passed to the native Node.js binary. The fix is minimal and surgical: it uses cygpath -w — the canonical MSYS2/Cygwin utility for POSIX→Windows path conversion — and falls back transparently to the unmodified path on platforms where cygpath is absent (Linux, macOS, WSL).

Key changes:

  • Introduces a cygpath availability check (command -v cygpath) before the exec node call.
  • On MSYS2/Git Bash: constructs NODE_SCRIPT via cygpath -w so Node.js receives a well-formed G:\...\install-apply.js path.
  • On all other platforms: NODE_SCRIPT is set to the unchanged POSIX path, preserving existing behavior exactly.
  • The npm install step (cd "$SCRIPT_DIR" && npm install …) is a shell-internal cd and is unaffected by the Windows path conversion problem, so it correctly remains unchanged.

Confidence Score: 5/5

Safe 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. cygpath is standard in every MSYS2/Cygwin environment; the command -v guard ensures no regression on other platforms. No logic, data, or security concerns are introduced. All remaining findings are P2 or absent.

No files require special attention.

Important Files Changed

Filename Overview
install.sh Adds cygpath -w path conversion for MSYS2/Git Bash environments so Node.js receives a valid Windows-native path; falls back gracefully on Linux/macOS where cygpath is absent.

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
Loading

Reviews (1): Last reviewed commit: "fix: resolve MINGW64 double-path convers..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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:

  1. Most users use default config discovery (no explicit paths)
  2. 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 708047f3-8d5f-4be7-a732-43c5643b32e9

📥 Commits

Reviewing files that changed from the base of the PR and between cff28ef and f2ec622.

📒 Files selected for processing (1)
  • install.sh

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@affaan-m affaan-m merged commit a4d4b1d into affaan-m:main Mar 30, 2026
7 of 8 checks passed
peiking88 pushed a commit to peiking88/everything-claude-code that referenced this pull request Apr 4, 2026
)

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.
FrancescoRosciano pushed a commit to FRosciano-Mambo/everything-claude-code that referenced this pull request Jun 1, 2026
)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: install.sh fails on Git Bash (MINGW64) with MODULE_NOT_FOUND

3 participants