我正在使用create-react-app工具来开发 React 应用程序。问题是,当我使用“npm start”命令运行应用程序时,它会在 Firefox 浏览器中打开,我希望它默认在 Chrome 浏览器中打开。
我发现许多答案提供了相同的解决方案,即在 package.json 文件中的脚本部分修改“开始”,但我用不同的代码一遍又一遍地尝试,但没有奏效。我不知道为什么我阅读的所有答案都没有解决我的问题。我在 Windows 7 中工作。
这是我的 package.json 代码:
{
"name": "jsx",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "cross-env PORT=8080 BROWSER='Chrome' react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last …Run Code Online (Sandbox Code Playgroud)