The Wayback Machine - https://web.archive.org/web/20210707034220/https://github.com/storybookjs/storybook/issues/15316
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

Storybook does not open in default browser #15316

Open
muster-mark opened this issue Jun 22, 2021 · 6 comments
Open

Storybook does not open in default browser #15316

muster-mark opened this issue Jun 22, 2021 · 6 comments

Comments

@muster-mark
Copy link

@muster-mark muster-mark commented Jun 22, 2021

Describe the bug
My default browser is Firefox (if I type open https://storybook.js.org/ in my console then it opens in Firefox. However when I run npm run storybook it opens in another browser I happen to have installed on my computer, called Google Chrome.

To Reproduce
Set Firefox as default Browser. In a Story book project, run npm run storybook

System
Environment Info:

System:
OS: macOS 11.4
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
npm: 6.14.11 - ~/.nvm/versions/node/v12.16.1/bin/npm
Browsers:
Chrome: 91.0.4472.114
Edge: 91.0.864.54
Firefox: 89.0.1
Safari: 14.1.1

@shilman
Copy link
Member

@shilman shilman commented Jun 22, 2021

FWWIW we use better-opn under the hood: https://www.npmjs.com/package/better-opn

@muster-mark
Copy link
Author

@muster-mark muster-mark commented Jun 23, 2021

Well it should be possible to detect the default browser and only use better-opn if it is one of the Chromium browsers supported by better-opn. Far more annoying for it to open in a different browser than a different tab.

@shilman
Copy link
Member

@shilman shilman commented Jun 23, 2021

@muster-mark PRs welcome!

@muster-mark
Copy link
Author

@muster-mark muster-mark commented Jun 24, 2021

I think the issue is with better-opn to be honest, it's hardly "better" if it doesn't open in the user's preferred browser. You may wish to use open instead of better-opn, though it may annoy chrome users who enjoyed that functionality. I am satisfied by using the --ci option to prevent opening in a browser at all. I am of the opinion that not opening in a browser would be a better default anyway.

@pilar1347
Copy link

@pilar1347 pilar1347 commented Jun 27, 2021

You can also install cross-env and change the storybook command to:
"storybook": "cross-env BROWSER=firefox start-storybook -p 6006 -s public"
This worked for me.

@muster-mark
Copy link
Author

@muster-mark muster-mark commented Jun 29, 2021

You can also install cross-env and change the storybook command to:
"storybook": "cross-env BROWSER=firefox start-storybook -p 6006 -s public"
This worked for me.

Thanks for the idea @pilar1357 but this is a multi-dev project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment