Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/bundle-desktop-windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Bundle Desktop (Windows)"

on:
workflow_dispatch:
workflow_call:
inputs:
version:
Expand Down
37 changes: 0 additions & 37 deletions ui/desktop/src/platform/windows/bin/install-node.cmd

This file was deleted.

48 changes: 31 additions & 17 deletions ui/desktop/src/platform/windows/bin/npx.cmd
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
@ECHO OFF
SETLOCAL EnableDelayedExpansion

SET "SCRIPT_DIR=%~dp0"
SET "NODE_VERSION=22.14.0"
SET "GOOSE_NODE_DIR=%LOCALAPPDATA%\Goose\node"

REM Try to find Node.js in standard locations first
if exist "C:\Program Files\nodejs\npx.cmd" (
"C:\Program Files\nodejs\npx.cmd" %*
exit /b %errorlevel%
REM === Check for previously downloaded portable Node.js (matching version) ===
if exist "%GOOSE_NODE_DIR%\node-v%NODE_VERSION%.installed" (
SET "PATH=%GOOSE_NODE_DIR%;!PATH!"
"%GOOSE_NODE_DIR%\npx.cmd" %*
exit /b !errorlevel!
)

if exist "C:\Program Files (x86)\nodejs\npx.cmd" (
"C:\Program Files (x86)\nodejs\npx.cmd" %*
exit /b %errorlevel%
)
REM === Download portable Node.js ===
echo [Goose] Node.js not found. Downloading portable Node.js v%NODE_VERSION%... 1>&2

SET "NODE_ZIP=%TEMP%\goose-node-%NODE_VERSION%.zip"
SET "NODE_EXTRACT=%TEMP%\goose-node-extract"

REM If Node.js not found, run installer
call "%SCRIPT_DIR%install-node.cmd" "https://nodejs.org/dist/v23.10.0/node-v23.10.0-x64.msi"
powershell -NoProfile -Command "$ProgressPreference='SilentlyContinue'; try { [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri 'https://nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%-win-x64.zip' -OutFile '%NODE_ZIP%' -UseBasicParsing; Expand-Archive -Path '%NODE_ZIP%' -DestinationPath '%NODE_EXTRACT%' -Force; exit 0 } catch { Write-Error $_.Exception.Message; exit 1 }"
if errorlevel 1 (
echo Failed to install Node.js
echo [Goose] ERROR: Failed to download Node.js. Please install manually from https://nodejs.org/ 1>&2
del "%NODE_ZIP%" >nul 2>&1
exit /b 1
)

REM Try using the newly installed Node.js
if exist "C:\Program Files\nodejs\npx.cmd" (
"C:\Program Files\nodejs\npx.cmd" %*
exit /b %errorlevel%
REM Clean previous version and install to Goose directory
rmdir /s /q "%GOOSE_NODE_DIR%" >nul 2>&1
mkdir "%GOOSE_NODE_DIR%" >nul 2>&1
xcopy /s /e /q /y "%NODE_EXTRACT%\node-v%NODE_VERSION%-win-x64\*" "%GOOSE_NODE_DIR%\" >nul 2>&1

REM Clean up
del "%NODE_ZIP%" >nul 2>&1
rmdir /s /q "%NODE_EXTRACT%" >nul 2>&1

if exist "%GOOSE_NODE_DIR%\npx.cmd" (
echo.>"%GOOSE_NODE_DIR%\node-v%NODE_VERSION%.installed"
SET "PATH=%GOOSE_NODE_DIR%;!PATH!"
echo [Goose] Node.js v%NODE_VERSION% ready. 1>&2
"%GOOSE_NODE_DIR%\npx.cmd" %*
exit /b !errorlevel!
)

echo Failed to find npx after Node.js installation
echo [Goose] ERROR: Installation failed. Please install Node.js manually from https://nodejs.org/ 1>&2
exit /b 1
2 changes: 1 addition & 1 deletion ui/desktop/src/utils/winShims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function ensureWinShims(): Promise<void> {
await fs.promises.mkdir(tgtDir, { recursive: true });

// Copy command-line tools, NOT goosed.exe (which should always be used locally)
const shims = ['uvx.exe', 'uv.exe', 'npx.cmd', 'install-node.cmd'];
const shims = ['uvx.exe', 'uv.exe', 'npx.cmd'];

await Promise.all(
shims.map(async (shim) => {
Expand Down