简体   繁体   English

Expo-无法连接到服务器

[英]Expo- Could not connect to the server

i trying to open a new project in my iphone , and it shows this message:我试图在我的 iphone 中打开一个新项目,它显示以下消息: 在此处输入图片说明

NOTE: the connection is LAN , on TUNNEL mode it works fine but slow注意:连接是 LAN ,在 TUNNEL 模式下它工作正常但速度慢

You tried to connect to the wrong IP.您试图连接到错误的 IP。 the 127.0.0.1 is a localhost IP. 127.0.0.1 是本地主机 IP。 You have to change to the IP where your Metro Builder Server runs on.您必须更改为运行 Metro Builder Server 的 IP。

Maybe this Thread helps you to change to the correct IP: React Native Expo change default LAN IP也许这个线程可以帮助您更改为正确的 IP: React Native Expo change default LAN IP

  • Change to LAN connection type in expo-cli在 expo-cli 中更改为 LAN 连接类型
  • Open it again from your phone用手机再次打开
  • If you get a similar error but with your LAN IP, your network does not allow connections between devices on the network, and you need to use tunnel or use simulator with localhost.如果您遇到类似的错误,但使用您的 LAN IP,则您的网络不允许网络上设备之间的连接,您需要使用隧道或使用带有 localhost 的模拟器。
  1. Open Start > Control Panel > System打开开始>控制面板>系统
  2. Go to Advanced System Settings > Environment Variables转到高级系统设置 > 环境变量
  3. Set a System Environment Variable with the following name/value pair:使用以下名称/值对设置系统环境变量:
  4. name: REACT_NATIVE_PACKAGER_HOSTNAME名称:REACT_NATIVE_PACKAGER_HOSTNAME
  5. value: < the IPv4 address you want to use > (if any address does not work, enter the current address IPV4 you are using)值:<您要使用的IPv4地址>(如果有任何地址不起作用,请输入您正在使用的当前IPV4地址)

That's it!就是这样!

IMPORTANT: remember to close and re-open the elevated PowerShell command prompt, since newly added Environment Variables wont' be available on the existing prompts.重要提示:请记住关闭并重新打开提升的 PowerShell 命令提示符,因为新添加的环境变量在现有提示中不可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Expo- av:自动播放视频 - Expo- av: Autoplay a video 放大:Expo 无法连接到开发服务器 - Amplify: Expo Could not connect to development server expo ios 模拟器“无法连接到开发服务器”错误(适用于浏览器) - expo ios simulator 'could not connect to development server' error(works on browser) Expo 项目报错 Could not connect to development server after update expo SDK - Expo project error Could not connect to development server after updating expo SDK React Native Jest Expo-Native 模块不能是 null - React Native Jest Expo- Native module cannot be null React Native Expo 中的 AsyncStorage - 如何获取数据? - AsyncStorage in react native expo- how to get data? 在Expo上运行React Native教程时出现“无法连接到开发服务器”错误,怀疑是Watchman - “could not connect to development server” error running React Native tutorial with Expo, suspecting Watchman expo- react native:有办法查看 expo 文件系统的内容并从那里删除内容吗? - expo- react native : there is way to see the content of the expo FileSystem and also delete content from there? 无法连接到开发服务器 - Could not connect to development server on Expo 将无法运行应用程序错误:无法连接到 TCP 端口 5554:无法连接到 127.0.0.1:5554: - Expo will not run the app Error: could not connect to TCP port 5554: cannot connect to 127.0.0.1:5554:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM