【发布时间】:2021-12-28 01:12:07
【问题描述】:
我在实践中使用react-native expo开发一个聊天应用,但是当我在通常的开发流程中突然执行“expo start”时,显示错误“无法连接到开发服务器”。
如果您遇到同样的错误并知道解决方案,如果您能提供帮助,我将不胜感激。
由于我之前是和aws-amplify链接的,我以为是因为这种关系安装的那个是错误的原因,但是由于应用程序在浏览器中正常启动,只有iOS模拟器不起作用(Android处于无限下载且无法启动的情况)
我尝试了什么
1)用expo start -c删除缓存
2)正如错误所说,npm start 然后重新加载重复。
3)用kill命令删除19000,以为是端口问题。 ・ npm 安装 ・ rm -rf node_modules / && rm -rf yarn_lock / && yarn install && cd ios && pod install
没有任何效果,我想不出任何好主意来解决它。研究中的所有解决方案都失败了。我还能做什么?
参考链接
Could not connect to React Native development server on Android
Could not connect to the development server react native ios simulator Node
package.json↓
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"-": "^0.0.1",
"@expo/vector-icons": "^12.0.0",
"@react-native-async-storage/async-storage": "^1.15.11",
"@react-native-community/masked-view": "0.1.10",
"@react-native-community/netinfo": "^6.2.1",
"@react-navigation/bottom-tabs": "5.11.2",
"@react-navigation/native": "~5.8.10",
"@react-navigation/stack": "~5.12.8",
"aws-amplify": "^4.3.6",
"aws-amplify-react-native": "^6.0.1",
"cli": "^1.0.1",
"expo": "~42.0.1",
"expo-asset": "~8.3.2",
"expo-constants": "~11.0.1",
"expo-font": "~9.2.1",
"expo-linking": "~2.3.1",
"expo-splash-screen": "~0.11.2",
"expo-status-bar": "~1.0.4",
"expo-web-browser": "~9.2.0",
"g": "^2.0.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
"react-native-gesture-handler": "~1.10.2",
"react-native-reanimated": "~2.2.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.4.0",
"react-native-web": "~0.13.12"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"jest-expo": "~41.0.0-beta.0",
"typescript": "~4.3.5"
},
"private": true
}
【问题讨论】:
标签: ios typescript react-native npm expo