-
Notifications
You must be signed in to change notification settings - Fork 214
Description
π Bug Description
The mint CLI completely fails to execute on Windows systems when the user's Windows username contains a space (e.g., "John Doe" β C:\Users\John Doe\).
π Environment
- OS: Windows 10/11
- Node Version: v22.18.0
- mint CLI Version: 4.2.202 (latest)
- Package Manager: pnpm 10.21.0 / npm 10.x
- Installation Method: Global install (
pnpm add -g mint/npm install -g mint)
π Steps to Reproduce
-
Use a Windows system with a username containing a space:
- Example:
C:\Users\Jack Luo\
- Example:
-
Install mint CLI globally:
pnpm add -g mint # OR npm install -g mint
-
Try to run any mint command:
mint --version # OR mint dev
-
Observe error:
C:\Users\Jack:1 [45F0:5078][2024-10-09T10:03:28]i001: Burn v3.14.1.8722... ^^ SyntaxError: Invalid or unexpected token at wrapSafe (node:internal/modules/cjs/loader:1620:18) at Module._compile (node:internal/modules/cjs/loader:1662:20) at Object..js (node:internal/modules/cjs/loader:1820:10)
β Expected Behavior
The mint CLI should execute successfully regardless of Windows username/path structure, just like other Node.js CLI tools (npm, npx, pnpm, etc.) handle paths with spaces correctly.
β Actual Behavior
- Installation succeeds:
pnpm add -g mintcompletes without errors - Binary created:
C:\Users\Jack Luo\AppData\Local\pnpm\mint.exeexists - Execution fails: Node.js cannot parse the path due to the space
- Error location: Stops at space character:
C:\Users\Jack:1(colon after "Jack" indicates parser stopped there)
π Root Cause Analysis
The mint CLI wrapper scripts or shims don't properly quote or escape Windows paths containing spaces. When Node.js attempts to execute the mint binary, it fails to parse the path:
// What's happening (simplified)
const mintPath = C:\Users\Jack Luo\AppData\Local\pnpm\mint.exe
// ^ Parser stops at space, treats "Luo" as syntax errorπ§ͺ Additional Testing
Test 1: Global Install via pnpm
PS C:\Users\Jack Luo> pnpm add -g mint
β
SUCCESS: Packages: +830, done in 22.7s
PS C:\Users\Jack Luo> mint --version
β FAIL: SyntaxError: Invalid or unexpected token at C:\Users\Jack:1Test 2: Using npx (also fails)
PS C:\Users\Jack Luo\project\mintlify> npx mint dev
β FAIL: Same SyntaxErrorTest 3: WSL Workaround (works!)
$ wsl
$ cd /mnt/c/Users/Jack\ Luo/project/mintlify
$ npx mint@latest dev
β
SUCCESS: Downloads mint and runs successfullyπ₯ Impact
High Severity:
- β Completely blocks Windows users with spaces in usernames
- β No workaround on native Windows (even npx fails)
β οΈ Forces users to either:- Use WSL (requires additional setup)
- Rename Windows user account (destructive, breaks many things)
- Create Windows junction to space-free path (advanced, requires admin)
Affected Users:
- Anyone with a two-word name: "John Doe", "Jane Smith", "Jack Luo", etc.
- Corporate environments with naming conventions: "FirstName LastName"
- Very common scenario - likely affects thousands of Windows users
π§ Suggested Fix
Ensure all path references in mint wrapper scripts are properly quoted. Example fix locations:
Possible locations (haven't inspected source, but likely culprits):
- Binary wrapper/shim generation
- Path resolution for Node.js execution
- Any hardcoded path strings
Example fix:
// β BAD - No quotes
const command = `node ${mintPath} ${args}`;
// β
GOOD - Properly quoted
const command = `node "${mintPath}" ${args}`;Also check:
- PowerShell script wrappers (
.ps1files) - Batch file wrappers (
.cmdfiles) - Node.js shims
β Current Workaround
For affected Windows users:
# Install WSL
wsl --install
# Navigate to project (Windows drives mount at /mnt/)
cd /mnt/c/Users/Jack\ Luo/project/mintlify
# Run mint via npx in WSL
npx --yes mint@latest devUpdate package.json to always use npx in WSL:
{
"scripts": {
"docs:dev": "cd mintlify && npx mint@latest dev",
"docs:lint": "cd mintlify && npx mint@latest broken-links"
}
}π Related Issues
- This is similar to path handling bugs that affected other Node.js CLIs in the past
- Likely affects all mint CLI commands (
dev,lint,deploy, etc.) - May also affect users with other special characters in paths
π Request
Please prioritize this fix as it blocks a significant portion of Windows users. The fix should be straightforward (adding proper path quoting), and would greatly improve the Windows development experience.
Additional Context:
- We spent several hours debugging this before identifying the root cause
- Initially thought it was pnpm configuration, but verified it's a mint CLI bug
- Happy to provide additional testing or information if needed
Thank you for maintaining Mintlify! π