reactjs - 为什么反应开发服务器自动使用https?
问题描述
我正在尝试调试我create-react-app
在移动设备上构建的 react 应用程序。所以我开始使用应用程序react-script start
,并确保所有设备都具有相同的 ip 和端口。但是当我尝试react dev server
在智能手机上访问时出现了错误,我所看到的只是空白页面。我从不使用react-script
类似的选项HTTPS=true
,但似乎试图请求使用HTTPS
。为什么?这是安卓手机的截图。
这是我的 package.json。
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@ant-design/icons": "^4.1.0",
"@emotion/styled": "^10.0.17",
"@fortawesome/fontawesome": "^1.1.8",
"@fortawesome/fontawesome-free-solid": "^5.0.13",
"@fortawesome/react-fontawesome": "0.0.20",
"@juggle/resize-observer": "^3.2.0",
"@material-ui/core": "^1.5.1",
"@material-ui/icons": "^3.0.2",
"@material-ui/styles": "^4.4.1",
"@n8tb1t/use-scroll-position": "^1.0.43",
"@react-hook/media-query": "^1.1.1",
"antd": "^4.2.5",
"auth0-js": "^9.8.1",
"axios": "^0.18.1",
"core-js": "^3.6.5",
"d3-ease": "^1.0.6",
"emotion": "^9.2.12",
"env-cmd": "^10.1.0",
"fast-deep-equal": "^2.0.1",
"formik": "^1.5.8",
"formik-effect": "^1.2.0",
"i18next": "^17.0.14",
"i18next-browser-languagedetector": "^3.0.3",
"i18next-xhr-backend": "^3.1.2",
"immutable": "^4.0.0-rc.12",
"jquery": "^3.5.1",
"js-cookie": "^2.2.0",
"jsonwebtoken": "^8.3.0",
"lodash": "^4.17.15",
"mapbox-gl": "^1.10.1",
"materialize-css": "^1.0.0-rc.2",
"moment": "^2.24.0",
"randomstring": "^1.1.5",
"react": "^16.10.2",
"react-app-polyfill": "^1.0.2",
"react-awesome-modal": "^2.0.5",
"react-circular-progressbar": "^2.0.3",
"react-countup": "^4.2.2",
"react-currency-input": "^1.3.6",
"react-dom": "^16.10.2",
"react-dropdown-tree-select": "^2.1.0",
"react-dropzone": "^4.2.12",
"react-emotion": "^9.2.12",
"react-flags-select": "^1.1.10",
"react-ga": "^2.7.0",
"react-google-login": "^5.0.4",
"react-google-maps": "^9.4.5",
"react-highcharts": "^16.0.2",
"react-i18next": "^10.12.3",
"react-iamport": "0.0.2",
"react-icons": "^3.7.0",
"react-images": "^0.5.17",
"react-map-gl": "^5.2.5",
"react-materialize": "^3.3.1",
"react-moment": "^0.7.7",
"react-move": "^6.4.0",
"react-paginate": "^6.3.0",
"react-password-strength": "^2.4.0",
"react-quill": "^1.3.3",
"react-redux": "^7.1.0-rc.1",
"react-responsive-carousel": "^3.1.50",
"react-reveal": "^1.2.2",
"react-router-dom": "^5.2.0",
"react-router-hash-link": "^1.2.2",
"react-scripts": "^3.4.1",
"react-share": "^3.0.0",
"react-slick": "^0.23.2",
"react-sortable-hoc": "^1.11.0",
"react-sticky": "^6.0.3",
"react-tooltip": "^3.11.1",
"react-transition-group": "^4.3.0",
"react-treebeard": "^3.2.4",
"react-typed": "^1.1.2",
"react-use-measure": "^2.0.1",
"redux": "^4.0.0",
"redux-actions": "^2.6.5",
"redux-promise": "^0.6.0",
"redux-saga": "^1.1.3",
"redux-thunk": "^2.3.0",
"regenerator-runtime": "^0.13.7",
"slick-carousel": "^1.8.1",
"socket.io-client": "^2.2.0",
"styled-components": "^4.3.2",
"universal-cookie": "^3.1.0",
"uuid": "^3.3.2",
"yup": "^0.27.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build:dev": "env-cmd -f ./.env.dev react-scripts build",
"build:prod": "env-cmd -f ./.env.prod 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 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"http-proxy-middleware": "^0.19.1",
"react-test-renderer": "^16.9.0",
"typescript": "^3.9.6"
}
}
解决方案
推荐阅读
- mongodb - $elemMatch 最后一个元素而不是第一个
- node.js - 你能在 find() 之后更新 then() 回调中返回的行吗?
- android - 在 Android XML 布局中,我可以使用子视图或视图组来着色父背景的一部分吗?
- python-3.x - 在 python 中将 pandas.core.frame.DataFrame 转换为 pandas 数据帧
- php - Laravel 容器返回多个 Singleton 实例
- beautifulsoup - 如何访问父节点中的子节点
- python - LSTM 模型的 ROC 曲线
- php - 使用 ON DUPLICATE KEY UPDATE 将 PHP 多维数组插入 Mysql 数据库
- mysql - AWS lightail ubuntu 18.04服务器上的Docker mysql 5.7不断重启
- c++ - C++ 编译器优化 - 为什么需要 constexpr?