Summary
Description
When running browser-use or browser-use-direct commands on Windows, the CLI exits immediately without executing any actions and without printing any errors.
Root Cause
This happens due to a strict string comparison check at the bottom of both dist/cli.js and dist/skill-cli/direct.js:
if (import.meta.url === `file://${process.argv[1]}`) {
main(); // or void main()
}
On Windows, import.meta.url resolves to a URL with forward slashes and the file protocol (e.g., file:///C:/Users/.../cli.js), whereas process.argv[1] contains Windows-style backslashes (e.g., C:\Users\...\cli.js). As a result, this equality check always evaluates to false on Windows, causing the script to exit without ever calling the main function.
Proposed Fix
Use node:url to convert the system path to a proper file URL so the comparison works cross-platform:
import url from 'node:url';
const isMain = import.meta.url === url.pathToFileURL(process.argv[1]).href;
if (isMain) {
main();
}
### Steps to reproduce
On a Windows machine, install the package globally: npm install -g browser-use
Open a terminal (PowerShell or Command Prompt) and attempt to run any CLI command, for example: browser-use --help (or) browser-use --headed open https://google.com
### Expected behavior
Expected Behavior: The CLI should print the help menu or launch the browser to navigate to the URL.
### Actual behavior
Actual Behavior: The command exits immediately with code 0. Nothing is printed to the console (aside from a standard Node punycode deprecation warning), and the browser does not launch.
### Environment
OS: Windows
Node: 18+
Package: browser-use (installed globally via npm)
Summary
Description
When running
browser-useorbrowser-use-directcommands on Windows, the CLI exits immediately without executing any actions and without printing any errors.Root Cause
This happens due to a strict string comparison check at the bottom of both
dist/cli.jsanddist/skill-cli/direct.js: