-
Notifications
You must be signed in to change notification settings - Fork 620
Open
Description
Description
When installing agent-browser globally on Windows via npm install -g agent-browser, the generated shims (.ps1 and .cmd) fail because they reference /bin/sh which doesn't exist on Windows.
Steps to Reproduce
- On Windows, run:
npm install -g agent-browser - Run:
agent-browser open https://example.com
Expected Behavior
The command should work, using the native Windows binary (agent-browser-win32-x64.exe).
Actual Behavior
PowerShell error:
& "/bin/sh.exe" ...
The term '/bin/sh.exe' is not recognized as a name of a cmdlet, function, script file, or executable program.
CMD error:
The system cannot find the path specified.
Root Cause
The generated shims in %APPDATA%\npm\ point to the shell script wrapper instead of the native Windows binary:
agent-browser.ps1 tries to run:
& "/bin/sh$exe" "$basedir/node_modules/agent-browser/bin/agent-browser" $argsagent-browser.cmd tries to run:
SET "_prog=/bin/sh"Workaround
Manually overwrite the shims to use the native binary:
agent-browser.cmd:
@ECHO off
"%~dp0\node_modules\agent-browser\bin\agent-browser-win32-x64.exe" %*agent-browser.ps1:
#!/usr/bin/env pwsh
$basedir = Split-Path $MyInvocation.MyCommand.Definition -Parent
& "$basedir\node_modules\agent-browser\bin\agent-browser-win32-x64.exe" $args
exit $LASTEXITCODESuggested Fix
Update package.json bin field to properly handle Windows, either by:
- Using a cross-platform bin wrapper that detects the OS and runs the appropriate binary
- Using npm's platform-specific bin configuration
Environment
- OS: Windows 11
- Node.js: v22.20.0
- npm: (global install)
- agent-browser: 0.6.0
martin-bosak, helalsoft, gdhyani, Hafeed3s, LiMolly and 5 more
Metadata
Metadata
Assignees
Labels
No labels