React Native 运行run-ios 出错解决

问题

在我搭建好rn环境运行react-native run-ios出现下面错误,导致程序始终跑不起来。

Command failed: /usr/***/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/imoocApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

原因

在查阅了网上大量资料发现,这个原因很可能是npm版本导致文件下载不全或者是rn版本导致。

解决方法

1.使用Yarn替代npm,运行一下命令安装Yarn,

//下载Yarn
npm install -g yarn react-native-cli
//设置国内镜像
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global

然后重新把node_modules文件和ios/build删除,

rm -rf node_modules
rm -rf ios/build

最后重新运行install,再run就可以解决如上问题

yarn install
react-native upgrade
react-native run-ios

2.除了上述方法还可以使用修改rn版本来解决

npm install --save react-native@0.18          //项目降级或升级到指定版本,记得react-native upgrade更新一下
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容