LoginSignup
7
3

More than 3 years have passed since last update.

create-react-appのnpm startで開くブラウザを変更する

Posted at

他にも記事がある気がしますが、自分がQiitaで調べた中では見つけられなかったのでメモします。

したいこと

create-react-appで用意した環境で、npm startで自動的に開くブラウザを変更したい。
MacだとデフォルトではChromeが優先して開くみたいで困る。

したこと

プロジェクト直下に.env.localファイルを作り以下のように記述1
例)FireFox

BROWSER="firefox"

これで自分の環境では上手く行きました。

ただ、ブラウザ名はOSによって指定の仕方が違うみたいです2
例)Chromeの場合
MacOS : google chrome
Windos: chrome
Linux : google-chrome

7
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3