React Native 填坑系列

1. 導(dǎo)入RealmJS 報(bào)錯(cuò) database is locked Possibly there are two concurrent builds running in the same filesystem location.

解決方案: Build Phases / Link Binary With Libraries 中導(dǎo)入 libRealmJS.a


WeChat2f104eb32f51b7adb3129125bb82c708.png

2. Make sure you're running a packager server or have included a .jsbundle file in your application bundle.

1. 查看8081端口占用情況
$  lsof -i tcp:8081
2. 殺死相關(guān)進(jìn)程
$ killall -9 node
3. 重啟編譯器或者電腦

3. React native項(xiàng)目iOS目錄 切換swift項(xiàng)目 導(dǎo)致node服務(wù)不會(huì)自動(dòng)執(zhí)行 有兩種解決方案:

1. 開啟兩個(gè)終端窗口, 分別執(zhí)行
$ react-native start
$ react-native run-ios
2. iOS swift項(xiàng)目中添加自動(dòng)開啟node服務(wù)的腳本
WechatIMG18.png

腳本中添加如下內(nèi)容:

     export RCT_METRO_PORT="${RCT_METRO_PORT:=8081}"
     echo "export RCT_METRO_PORT=${RCT_METRO_PORT}" > "${SRCROOT}/../node_modules/react- 
     native/scripts/.packager.env"
     if [ -z "${RCT_NO_LAUNCH_PACKAGER+xxx}" ] ; then
     if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then
     if ! curl -s "http://localhost:${RCT_METRO_PORT}/status" | grep -q "packager-status:running" ; then
     echo "Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly"
     exit 2
     fi
     else
     open "$SRCROOT/../node_modules/react-native/scripts/launchPackager.command" || echo "Can't start 
     packager automatically"
     fi
     fi

4. No bundle URL present. Make sure you're running a packager server or have included a .jsbundle file in your application bundle.

command+D 打開調(diào)試菜單 -> Configure Bundler -> 配置本機(jī)IP地址


WeChat155ad905b7116f202eb33dd2efa24c41.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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

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