fix(windows): make first-run setup work on Windows - #2
Merged
Conversation
Three independent Windows-only failures prevented first-run setup from completing. Reported in danvelope#1. 1. pip.exe cannot upgrade itself. bootstrap() ran every pip command via venv\Scripts\pip.exe, and the first one upgrades pip, which pip refuses when launched as pip.exe because it cannot replace its own running executable. Since it is the first pip call, setup could never proceed on Windows. All four call sites now go through `python -m pip`, the recommended invocation on every platform and a no-op change on macOS. This also repairs the in-app "update yt-dlp" action, which hit the same refusal. venvPip() is removed as it is now unused (noUnusedLocals). 2. Bare `tar` could resolve to GNU tar. GNU tar reads "C:\..." as a remote host ("Cannot connect to C: resolve failed", exit 2), so extraction of the Python runtime failed whenever Git for Windows' usr\bin preceded System32 on PATH. Prefer Windows' built-in bsdtar by absolute path. 3. run.cjs passed an unquoted path with shell: true, so a checkout path containing spaces was split at the first space. Quote it when shelling out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
|
wow thank you so so much 🙇♂️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1.
Three independent Windows-only failures that together prevent first-run setup from completing. Each has its own root cause and its own fix; they're described separately below. Another participant on #1 has confirmed these resolve the install failure on their Windows machine.
Scope note: severity differs a lot between them. Fix 1 affects every Windows user, including the packaged installer. Fixes 2 and 3 are narrower and environment-dependent — I've said where each actually fires rather than implying all three are universal.
1.
pip.execannot upgrade itself (blocking)bootstrap()ran every pip command throughvenv\Scripts\pip.exe, and the first of those upgrades pip itself. pip refuses that when launched aspip.exe, because it can't replace its own running executable:Since it's the first pip call in
bootstrap(), setup could never get past it on Windows. The UI showed onlypip upgrade failed (1).All four call sites now go through
python -m pip, which is the recommended invocation on every platform and is a no-op behavioural change on macOS. That includesupdateYtDlp(), which hit the same refusal — so the in-app "update yt-dlp" repair action was also broken on Windows, meaning the documented recovery path for yt-dlp breakage didn't work there either.venvPip()becomes unused and is removed, sincenoUnusedLocalsis enabled intsconfig.node.json.2. Bare
tarcan resolve to GNU tarextractArchive()spawnedtarby bare name, lettingPATHpick the binary. Windows may have two, and Git for Windows ships GNU tar. GNU tar comes from the Unix world wherehost:pathmeans a remote tape drive, so givenC:\Users\...it treatsC:as a hostname:Extraction then produced nothing, and setup reported
No suitable python3 found on this machine— pointing at Python detection rather than the extract that actually failed. Now prefers Windows' built-in bsdtar by absolute path, falling back totarelsewhere. macOS behaviour is unchanged.This only fires when GNU tar precedes
System32onPATH(e.g. launching from Git Bash), so it won't affect every Windows user — but it's a coin flip depending on environment.3.
run.cjspassed an unquoted path to a shellrunSteps()enablesshell: truefor.cmdbinaries but passed the resolved path unquoted, so a checkout path containing spaces was split at the first space:Now quoted when shelling out. Source builds only; packaged users are unaffected.
Testing
npm run typecheck:nodepasses cleanDeliberately not included
separate.pyselectsmpsorcpuonly, so Windows always runs on CPU. That's a feature change rather than a bug fix and belongs in its own PR — happy to raise it separately if it's of interest.spawncalls attach only aclosehandler, so pip's actionable message was discarded. Worth doing, but it's a behavioural change beyond these fixes, so I've left it out.pyCandidates()probes hardcodedPython312/311/310/39paths, so newer system Pythons are invisible. In my case that was accidentally the right outcome (demucs/torch have no 3.14 wheels), but it works by luck. Also left alone here.