Bug
install.ps1 fails on Windows PowerShell 5.1 with a SyntaxError mid-way through the JSON merge script:
[eval]:17
command: 'node '
Expected ',', got '<eof>'
SyntaxError: Unexpected end of input
Root cause
Line 183 passes the multiline JS here-string to Node via node -e $nodeScript. On Windows, PowerShell passes arguments to external executables through the Windows command processor, which terminates the argument at the first unescaped double-quote character. The JS string contains 'node "' + hooksDir + ... — the " after node ends the argument, so Node only receives a truncated fragment.
The hook files are copied successfully but settings.json is never updated, leaving caveman non-functional.
Fix
Write the script to a temp file and run node tempfile.js instead of node -e. Temp file is cleaned up in a finally block.
$tmpScript = Join-Path $env:TEMP "caveman-install-$([System.Diagnostics.Process]::GetCurrentProcess().Id).js"
try {
[System.IO.File]::WriteAllText($tmpScript, $nodeScript, [System.Text.Encoding]::UTF8)
node $tmpScript
} finally {
if (Test-Path $tmpScript) { Remove-Item $tmpScript -Force }
}
PR with fix: https://github.com/scottconverse/caveman/pull/new/fix/windows-node-e-truncation
Environment
- Windows 11 Pro 10.0.26200
- Windows PowerShell 5.1
- Node.js v24.14.0
Bug
install.ps1fails on Windows PowerShell 5.1 with aSyntaxErrormid-way through the JSON merge script:Root cause
Line 183 passes the multiline JS here-string to Node via
node -e $nodeScript. On Windows, PowerShell passes arguments to external executables through the Windows command processor, which terminates the argument at the first unescaped double-quote character. The JS string contains'node "' + hooksDir + ...— the"afternodeends the argument, so Node only receives a truncated fragment.The hook files are copied successfully but
settings.jsonis never updated, leaving caveman non-functional.Fix
Write the script to a temp file and run
node tempfile.jsinstead ofnode -e. Temp file is cleaned up in afinallyblock.PR with fix: https://github.com/scottconverse/caveman/pull/new/fix/windows-node-e-truncation
Environment