高高興興升級了RN,卻發(fā)現(xiàn)運行不起來
確認(rèn)build文件配置
第一步:

image.png
第二步:

image.png
第三步:

image.png
確認(rèn)node,npm,watchman最新
node,npm
# 先安裝模塊n
npm install n -g
# 將 node 升級到最新穩(wěn)定版
n stable
# 將 npm 升級到最新版
npm install npm -g
# 如果要指定版本,可以通過@指定版本
# npm install npm@3.10.10 -g
#watchman
npm r -g watchman
brew install watchman
現(xiàn)在出現(xiàn)運行一下就好了,不用改代碼真好
可能遇到對錯誤
Error: fsevents unavailable (this watcher can only be used on Darwin)
react native環(huán)境跑不起來,終端報
Error: `fsevents` unavailable (this watcher can only be used on Darwin)
后面查找到原因watchman版本過舊或者錯誤,重新安裝了watchman
npm r -g watchman
brew install watchman
如果你不幸運,遇到權(quán)限問題導(dǎo)致安裝無法成功,可以嘗試卸載后重裝
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
xcode-select 安裝失敗
不要慌,百度一下發(fā)現(xiàn)解決方法全是執(zhí)行如下指令:
xcode-select --install
但是有時執(zhí)行該指令時會遇到如下問題:
不能安裝該軟件,因為當(dāng)前無法從軟件更新服務(wù)器獲得。
這個時候也不要慌,直接去developer.apple.com下載就好了。
進去選擇自己版本相應(yīng)的Command Line Tools,下載安裝就ok了。

image.png
小禮物走一走,來簡書關(guān)注我