React Native 運(yùn)行run-ios 出錯(cuò)解決

問題

在我搭建好rn環(huán)境運(yùn)行react-native run-ios出現(xiàn)下面錯(cuò)誤,導(dǎo)致程序始終跑不起來。

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

原因

在查閱了網(wǎng)上大量資料發(fā)現(xiàn),這個(gè)原因很可能是npm版本導(dǎo)致文件下載不全或者是rn版本導(dǎo)致。

解決方法

1.使用Yarn替代npm,運(yùn)行一下命令安裝Yarn,

//下載Yarn
npm install -g yarn react-native-cli
//設(shè)置國內(nèi)鏡像
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

最后重新運(yùn)行install,再run就可以解決如上問題

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

2.除了上述方法還可以使用修改rn版本來解決

npm install --save react-native@0.18          //項(xiàng)目降級或升級到指定版本,記得react-native upgrade更新一下
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容