create-react-app: How do I “npm start” with a specific browser?

后端 未结 11 1971
一个人的身影
一个人的身影 2021-01-31 07:11

npm start

starts the react server on the default browser, which is Firefox for me. I like Firefox for browsing but prefer Chrome in web deve

11条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-31 08:15

    I don't like to repeatedly create a new .env file or prepend npm start every time with an additional command. You can specify your browser of choice instead of none in your shell config file. Type in your terminal the following commands:

    echo export BROWSER=none >> ~/.bashrc
    source ~/.bashrc
    

    At this point you can run npm start and be happy.

提交回复
热议问题