react-native - 调试本机反应时出错?
问题描述
TypeError [ERR_INVALID_PROTOCOL]: Protocol "localhost:" not supported. Expected "http:". Debugging won't work: Try reloading the JS from inside the app, or Reconnect the VS Code debugger: Couldn't import script at <localhost:8081/Users/sandesh/Library/Developer/CoreSimulator/Devices/85B2AD76-7F82-48EC-AF36-B10C5DE8E783/data/Containers/Bundle/Application/B7545C06-A275-410D-9C57-C62B1931AF3C/eRamp.app/bundle/index.ios.jsbundle> (error code 1408)
launch.json 如下
"version": "0.2.0",
"configurations": [
{
"name": "Debug iOS ete",
"cwd": "${workspaceFolder}",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"env": {
"ENVFILE": ".env.ete"
}
},
{
"name": "Debug Android ete",
"cwd": "${workspaceFolder}",
"type": "reactnative",
"request": "launch",
"platform": "android",
"env": {
"ENVFILE": ".env.ete"
}
},
解决方案
要在本机反应中启用调试,
如果您在模拟器中按 Ctrl + M 或者如果在您的设备中摇动它,将出现一个对话框,您将在其中看到“调试”选项,只需按下它,您将自动被重定向到您的网络浏览器。
按Ctrl + Shift + I开始调试。
推荐阅读
- amazon-web-services - AWS RDS aurora - 创建跨区域只读副本 - 通过 boto3 或 aws cli
- javascript - 将getTime从日期添加到另一个没有时间的日期javascript
- php - 试图从 morphMany 关系中获取收藏项目的值
- javascript - React 组件在 prop 更改时重新渲染
- javascript - 更改/替换完整的 Javascript 代码
- postgresql - 直接查询 Postgres INHERITED 表
- python - Spotipy - 用于 Python 无效推荐请求的 Spotify API
- python - TypeError:元组索引必须是整数,而不是使用 pyspark 和 RDD 的 str
- jenkins - 詹金斯管道 - 分支参数问题
- python - PySpark 中的高效列处理