我在调试用react native构建的应用程序时遇到了问题。每当我开始构建时,它都会给我一个错误,无法连接到开发服务器。我尝试了各种解决方案,如升级npm、清除监视器缓存、重新启动npm。但没有一个解决方案起作用。非常需要帮助!!!
我在调试用react native构建的应用程序时遇到了问题。每当我开始构建时,它都会给我一个错误,无法连接到开发服务器。我尝试了各种解决方案,如升级npm、清除监视器缓存、重新启动npm。但没有一个解决方案起作用。非常需要帮助!!!
# Clean cache
rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all
# Open a new tab and Start Metro Bundler directly from the project folder
react-native start --reset-cache
# Now run `react-native run-android` or `react-native run-ios`
原始的链接
// Workaround for local IP:
return [NSURL URLWithString:@"http://192.168.178.62:8081/index.bundle?platform=ios"];
// return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
选择自己的IP地址作为http地址并尝试一下。 要检查是否可以访问打包器URL,您也可以在浏览器中尝试一下。