docusaurus start - Failed to open browser
Have you read the Contributing Guidelines on issues?
- [x] I have read the Contributing Guidelines on issues.
Prerequisites
- [x] I'm using the latest version of Docusaurus.
- [x] I have tried the
npm run clearoryarn clearcommand. - [x] I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - [ ] I have tried creating a repro with https://new.docusaurus.io.
- [x] I have read the console error message carefully (if applicable).
Description
When running docusaurus start I get the following console errors:
$ docusaurus start
[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/
● Client ██████████████████████████████████████████████████ (10%) building /Users/chenriques/Documents/navigator-docs/node_modules/webpack/hot/dev-server.js Failed to open browser Microsoft Edge with AppleScript 995 | if (!isURLInstance(fileURLOrPath))
996 | return fileURLOrPath;
997 | return Bun.fileURLToPath(fileURLOrPath);
998 | }
999 | var { Error, TypeError } = globalThis;
1000 | let err = new Error(message);
^
error: Command failed: osascript openChrome.applescript "http://localhost:3000/" "Microsoft Edge"
openChrome.applescript:848:858: script error: A property can’t go after this identifier. (-2740)
code: 1,
killed: false,
signal: null,
cmd: "osascript openChrome.applescript \"http://localhost:3000/\" \"Microsoft Edge\"",
stdout: "",
stderr: "openChrome.applescript:848:858: script error: A property can’t go after this identifier. (-2740)\n",
at genericNodeError (node:child_process:1000:13)
at exitHandler (node:child_process:103:28)
at emit (node:events:98:22)
at #maybeClose (node:child_process:768:16)
at #handleOnExit (node:child_process:520:72)
● Client ██████████████████████████████████████████████████ (58%) building /Users/chenriques/Documents/navigator-docs/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!/Users/chenriques/Documents/navFailed to open browser Brave Browser with AppleScript 995 | if (!isURLInstance(fileURLOrPath))
996 | return fileURLOrPath;
997 | return Bun.fileURLToPath(fileURLOrPath);
998 | }
999 | var { Error, TypeError } = globalThis;
1000 | let err = new Error(message);
^
error: Command failed: osascript openChrome.applescript "http://localhost:3000/" "Brave Browser"
openChrome.applescript:848:858: script error: A property can’t go after this identifier. (-2740)
code: 1,
killed: false,
signal: null,
cmd: "osascript openChrome.applescript \"http://localhost:3000/\" \"Brave Browser\"",
stdout: "",
stderr: "openChrome.applescript:848:858: script error: A property can’t go after this identifier. (-2740)\n",
at genericNodeError (node:child_process:1000:13)
at exitHandler (node:child_process:103:28)
at emit (node:events:98:22)
at #maybeClose (node:child_process:768:16)
at #handleOnExit (node:child_process:520:72)
● Client ██████████████████████████████████████████████████ (100%) emitting after emit client (Rspack 1.5.8) compiled successfully
Even though it throws these errors, it still manages to open the application on Microsoft Edge.
Reproducible demo
No response
Steps to reproduce
- Run docusaurus start on macOS 26 with Microsoft Edge as the default browser.
Expected behavior
The app should start without errors.
Actual behavior
The app starts with errors.
Your environment
- Public source code:
- Public site URL:
- Docusaurus version used: 3.9.1
- Environment name and version: Microsoft Edge 141.0.3537.71, Bun 1.3.0
- Operating system and version: macOS Tahoe 26.0
Self-service
- [ ] I'd be willing to fix this bug myself.
Weird, have you tried with another browser?
I think it's related to AppleScript and macOS 26, but can't be sure.
Weird, have you tried with another browser?
I think it's related to AppleScript and macOS 26, but can't be sure.
I have three browsers installed on my laptop: Safari, Microsoft Edge, and Brave. It seems that docusaurus start tries to open the local environment in the default browser, but it also checks for other installed browsers and ends up throwing errors for all Chromium-based ones (Edge and Brave).
When I changed my default browser to Safari, the local app opened correctly in Safari, but the same two errors for Edge and Brave still appeared.
Then I installed Firefox and set it as the default browser. When running docusaurus start, it opened the app in Firefox and again only showed errors for Edge and Brave. So the issue seems to be specific to Chromium-based browsers.
@cehenriques I have raised a separate issue regarding Arc (another Chromium browser) in #11582.
Wasn't able to reproduce your error using Edge, though the error message suggests the value of targetWindow isn't what the script is expecting. Would you be open to adding some debug logging to openChrome.applescript in your environment to see what's happening?
@cehenriques unfortunately I can't troubleshoot this issue without running macos 26 myself. I tried to get a remote server on AWS EC2 but for unknown reasons it won't let me create the instance 🤷♂️ .
What's surprising is that your error message mentions a script error on line 848, and the script only has 94 LOC.
Can you please print the result of these commands?
nl -ba ./node_modules/@docusaurus/core/lib/commands/utils/openBrowser/openChrome.applescript
osacompile -o openChrome.scpt ./node_modules/@docusaurus/core/lib/commands/utils/openBrowser/openChrome.applescript
It's possible the script has been altered by you, or altered by a malicious actor? 🤷♂️
Also, please try to upgrade your macOS v26 to the latest? Maybe it's a bug in their AppleScript version 🤷♂️
Hi @slorber. The '848:858' refers to byte position (I don't know why 🤷). In 3.9.1 that's this code on line 34:
Best guess would be whatever targetWindow points to, it's not anything that has an active tab index property. Hence suggestion to add some in situ debugging.