Skip to content
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

Vite trigger MacOS system dialog to locate 'undefined' application when Google Chrome is not running #11205

Closed
7 tasks done
pvljz opened this issue Dec 5, 2022 · 2 comments · Fixed by #11406
Closed
7 tasks done
Assignees

Comments

@pvljz
Copy link

pvljz commented Dec 5, 2022

Describe the bug

Vite feature to open running instance of Chrome browsers doesn't fail immediately when Chrome is not running (openedBrowser is undefined), instead MacOS system dialog "Choose Application" - "Where is undefined?" is displayed. Only after closing this dialog, exception is thrown and catched in script and continue to opening new Google Chrome instance.
Please don't execute osascript with undefined openedBrowser or use value from preferredOSXBrowser when openedBrowser is undefined.
https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/openBrowser.ts#L93

Reproduction

https://stackblitz.com/edit/vitejs-vite-hntcyg?file=package.json

Steps to reproduce

vite 3.2.5
be sure there is no running process 'Google Chrome'
execute command:
BROWSER="Google Chrome" vite
MacOS system dialog "Choose Application" - "Where is undefined?" is displayed because vite execute:
osascript openChrome.applescript http://127.0.0.1:8080/index.html undefined
https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/openBrowser.ts#L93

System Info

System:
    OS: macOS 12.6
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.2
    npm: 8.5.0
  Browsers:
    Chrome: 107.0.5304.121
    Firefox: 106.0.2
    Safari: 16.0
  npmPackages:
    vite: ^3.2.5 => 3.2.5

Used Package Manager

npm

Logs

No response

Validations

@bluwy bluwy added bug and removed pending triage labels Dec 9, 2022
@ArnaudBarre ArnaudBarre self-assigned this Dec 9, 2022
@NetOpWibby
Copy link

I just narrowed down this issue to Vite as well, in my SvelteKit project. Firefox is my browser of choice and is always running when I start my application, so this issue title should remove everything after "application."

@NetOpWibby
Copy link

This has been happening for months btw.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants