Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(issue-1792): rebuild esbuild via npm in setup.ps1 instead of a hardcoded path

[._.]/ Adam Eivya1542bc1b4d1
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index cead00bc7d..02056db125 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,7 @@
## Setup
+- **[issue-1792] Windows setup no longer aborts rebuilding esbuild.** Running `setup.ps1` on Windows could stop partway with `Error: Cannot find module ...\client\node_modules\esbuild\install.js`. The script ran esbuild's installer through a hardcoded path that only exists when esbuild is installed directly under `client/node_modules` — but npm often hoists it to the project's top-level `node_modules`, so the fixed path was missing and setup bailed. It now rebuilds esbuild with `npm rebuild esbuild`, which finds esbuild wherever it actually landed, matching how the Mac/Linux setup already works. (Closes #1792)
- **[issue-1788] Windows setup no longer fails to launch on the default PowerShell.** Running `setup.ps1` on Windows PowerShell 5.1 errored out before doing anything (`The string is missing the terminator` / `Missing closing '}'`). The scripts contained accented punctuation and an emoji but were saved without a UTF-8 byte-order mark, so the default Windows PowerShell read them in the legacy system codepage and mis-parsed those characters. `setup.ps1`, `update.ps1`, and `scripts/setup-voice.ps1` now carry a UTF-8 BOM so they parse correctly on both Windows PowerShell 5.1 and PowerShell 7+, and a test keeps any future `.ps1` from regressing. (Closes #1788)
## AI Providers
diff --git a/setup.ps1 b/setup.ps1
index e6a6564c1b..1673b34141 100644
--- a/setup.ps1
+++ b/setup.ps1
@@ -60,13 +60,20 @@ npm install
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
Pop-Location
-# Rebuild native bindings
+# Rebuild native bindings. Use `npm rebuild esbuild` instead of invoking a
+# hardcoded client/node_modules/esbuild/install.js path: npm resolves esbuild
+# wherever it was actually hoisted/deduped, whereas the fixed nested path doesn't
+# exist when esbuild lands in the root node_modules — that path mismatch is what
+# aborted setup.ps1 with MODULE_NOT_FOUND on Windows (issue #1792). Mirrors the
+# cross-platform `npm run setup` script and setup.sh.
Write-Host ""
Write-Host "Rebuilding esbuild, node-pty & sharp..." -ForegroundColor Yellow
-node client/node_modules/esbuild/install.js
-if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
-node server/node_modules/esbuild/install.js
+npm rebuild esbuild --prefix client
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+# esbuild may not be a direct server dependency — don't fail setup if it's absent
+# (matches the `|| true` guard around the same step in `npm run setup`).
+npm rebuild esbuild --prefix server
+$global:LASTEXITCODE = 0
npm rebuild node-pty sharp --prefix server
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }