運行程序
千呼萬喚屎出來,終于可以運行了。O(∩_∩)O哈哈~
??車開起來,小坑填一下,就能抵達勝利的彼岸了。在這個過程中,我遇到一下幾個小問題,我就按我遇到的問題的順序梳理一下。
問題一:
Packager can't listen on port 8081
1
??解決辦法:可能是其他的packager正在運行,關(guān)閉其他的Pachager即可。
問題二:
com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly
1
問題原因:沒有找到執(zhí)行的bundle文件。
解決方案:
adb reverse tcp:8081 tcp:8081
如果1不起作用,使用react-native bundle 命令生成好bundle放在assets 中,程序就可以向引用資源一樣,使用我的js文件。
命令同2,將下面的命令寫到package.json 的script中,當(dāng)執(zhí)行npm start 時,會自動打bundle。命令行如下:
$ react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output assets/index.android.bundle --sourcemap-output assets/index.android.map --assets-dest res/
1
要根據(jù)自己的項目目錄結(jié)構(gòu)進行修改。
問題三
Duplicate module name: react-native-vector-icons
1
??解決方案:一個Application應(yīng)用存在多個node_module文件引發(fā)的問題,可能在Library中也有node_module可以刪除掉其中一個,讓另一個去引用已經(jīng)存在的就OK。
---------------------
原文:https://blog.csdn.net/u013531824/article/details/53496011
問題四:
新創(chuàng)建的工程報錯 Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste mod.
The issue can be fix by doing:
npm add @babel/runtime
npm install
But we shouldn't have to do all this stuff !
原文:https://blog.csdn.net/weixin_33811539/article/details/87548453