-
Notifications
You must be signed in to change notification settings - Fork 606
fix(windows): Fix npm wrapper scripts for Windows #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit fixes the Windows wrapper scripts generated by npm to properly
call the native Windows binary instead of failing to find /bin/sh.
Changes:
- Updated bin/agent-browser.cmd to detect architecture and directly call
the agent-browser-win32-{arch}.exe binary
- Updated bin/agent-browser shell script to properly add .exe extension
for Windows binaries when running in Git Bash/MSYS environments
- Added proper error messages when binary is not found
Fixes the issue where running 'agent-browser' on Windows would fail with
"The system cannot find the path specified" or "/bin/sh.exe not found"
errors.
Testing:
- Tested on Windows 11 with PowerShell
- Tested on Windows 11 with CMD
- Verified binary detection and execution works correctly
|
@0okay is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
|
||
| :: Detect architecture | ||
| set "ARCH=x64" | ||
| if "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "ARCH=arm64" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if "%PROCESSOR_ARCHITECTURE%"=="x86" ( | ||
| if not defined PROCESSOR_ARCHITEW6432 set "ARCH=x86" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if "%PROCESSOR_ARCHITECTURE%"=="x86" ( | |
| if not defined PROCESSOR_ARCHITEW6432 set "ARCH=x86" | |
| ) | |
| :: Note: x86 detection (32-bit Windows) is not supported as only x64 binaries are built. | |
| :: On 32-bit systems, x64 emulation will be used (default ARCH=x64 above). |
Windows 32-bit detection sets ARCH=x86 but no agent-browser-win32-x86.exe binary is built, causing npm install to fail on 32-bit Windows systems
| echo Error: agent-browser binary not found at %BINARY% >&2 | ||
| echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally. >&2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| echo Error: agent-browser binary not found at %BINARY% >&2 | |
| echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally. >&2 | |
| echo Error: agent-browser binary not found at %BINARY% | |
| echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally. |
Invalid stderr redirection syntax >&2 in Windows batch file that doesn't support Unix-style redirection
This PR fixes the Windows wrapper scripts generated by npm to properly call the native Windows binary instead of failing to find /bin/sh.
Changes
bin/agent-browser.cmdto detect architecture and directly call theagent-browser-win32-{arch}.exebinarybin/agent-browsershell script to properly add.exeextension for Windows binaries when running in Git Bash/MSYS environmentsProblem
On Windows, running
agent-browserwould fail with errors like:This was because the npm-generated wrapper scripts tried to use
/bin/shwhich doesn't exist on standard Windows installations.Solution
Modified the wrapper scripts to directly invoke the platform-specific native binary (
agent-browser-win32-x64.exe) instead of trying to run a shell script through/bin/sh.Testing
agent-browsercommand now works without errors