新司機教你不降版本正確解決ReactNative初始化遇到的“Print: Entry, ":CFBundleIdentifier", Does Not Exist


新司機教你不降版本正確解決ReactNative初始化遇到的“Print: Entry, ":CFBundleIdentifier", Does Not Exist”

照着官方文檔的步驟進行ReactNative項目初始化時,聽說在國內的網絡環境下多半會遇到這個問題。

環境

node: v8.5.0
react: 16.3.0-alpha.1
react-native: 0.54.3
Xcode: Version 9.2 (9C40b)

安裝步驟

react-native init projectName
cd projectName
react-native run-ios

報錯信息

Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

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

錯誤原因

在項目的issues中查看了很多信息,究其原因,無非就是官方提供的boost_1_63_0.tar.gz有問題,通過yarnnpm下載到的包才12MB左右,而正常的包大小有93MB左右。

網上能找到大部分都是直接下載正確的boost_1_63_0.tar.gz覆蓋~/.rncache/boost_1_63_0.tar.gz,然后再react-native run-ios

我可以很負責任的告訴大家,這樣根本不!好!使!為什么呢,因為react-native的第三方庫的安裝腳本中有對這些包做hash校驗,具體的可以看看這里的內容:node_modules/react-native/scripts/ios-install-third-party.sh

終極解決辦法

我們的原則是不降版本,就用最新版本!

第一步:下載正確的boost_1_63_0.tar.gz覆蓋~/.rncache/boost_1_63_0.tar.gz,下載地址在這里boost_1_63_0.tar.gz

第二步:使用shasum跑出~/.rncache/boost_1_63_0.tar.gzhash字符串備用

➜  ~ shasum ~/.rncache/boost_1_63_0.tar.gz
f8e4d5aeaa65f429f4135b037d3c3528be5ebf77  /Users/erniu/.rncache/boost_1_63_0.tar.gz

第三步:打開項目中的node_modules/react-native/scripts/ios-install-third-party.sh,替換boost_1_63_0.tar.gzhash串為你第二步中得到的hash

fetch_and_unpack glog-0.3.4.tar.gz https://github.com/google/glog/archive/v0.3.4.tar.gz 69f91cd5a1de35ead0bc4103ea87294b0206a456 "\"$SCRIPTDIR/ios-configure-glog.sh\""
fetch_and_unpack double-conversion-1.1.5.tar.gz https://github.com/google/double-conversion/archive/v1.1.5.tar.gz 96a8aba1b4ce7d4a7a3c123be26c379c2fed1def
# fetch_and_unpack boost_1_63_0.tar.gz https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz c3f57e1d22a995e608983effbb752b54b6eab741
fetch_and_unpack boost_1_63_0.tar.gz https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz f8e4d5aeaa65f429f4135b037d3c3528be5ebf77
fetch_and_unpack folly-2016.09.26.00.tar.gz https://github.com/facebook/folly/archive/v2016.09.26.00.tar.gz f3b928b5039235bad6cece638c597c6684d1e4e6

第四步:好了,這時候重新再編譯一次,不出意外就正常跑起來了。

react-native run-ios


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM