1. 程式人生 > >react-native常見錯誤整理

react-native常見錯誤整理

bubuko 新建 分享 deb likely can 簽名 amp whoami

1、CFBundleIdentifier", Does Not Exist

sudo rm -rf node_modules && rm -rf ~/.rncache && yarn

sudo npm install -g react-native-git-upgrade

2、Build input file cannot be found: ‘xxx/third-party/double-conversion-1.1.5/‘…

新建的React Native 項目,凡是版本號大於0.45的,iOS版本在build的時候會卡在build double conversion 這裏。

  • 查詢具體需要的三方庫
  • 鏈接: https://pan.baidu.com/s/1-YccvCHdn17odP_RDl1J8w 提取碼: grdc
  • 下下來後,把這些壓縮文件放到 ~/.rncache(Mac操作:Finder=》前往文件夾=》~/.rncache)

3、third-party/glog-0.3.4/src/base/mutex.h:105:10: ‘config.h‘ file not found

cd node_modules/react-native/third-party/glog-0.3.4

../../scripts/ios-configure-glog.sh

4、React Native version mismatch

技術分享圖片

watchman watch-del-all && react-native start --reset-cache

This might be related to https://github.com/facebook/react-native/issues/4968

To resolve try the following:

1. Clear watchman watches: `watchman watch-del-all`.

2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.

3. Reset Metro Bundler cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`.

5、權限問題

chown -R wood:staff ~/.npm 讓該目錄下的所有文件都有wood用戶權限

groups 查看當前用戶所屬組

groups wood 查看指定用戶所屬組

id -a wood 可以查到指定用戶所屬組更詳細的信息

whoami 查看當前用戶的用戶名

6、Execution failed for task ‘:app:installDebug‘.

at com.android.ddmlib.Device.installPackage(Device.java:869)

> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_INSUFFICIENT_STORAGE

at com.android.builder.testing.ConnectedDevice.installPackage

是因為包名和簽名的信息與原先手機上的沖突,最簡單的方式,通過adb uninstall packageName將原來的App卸載幹凈,重新執行就可以成功了

7、Attempted to transition from state RESPONDER_INACTIVE_PRESS_IN to RESPONDER_ACTIVE_LONG_PRESS_IN, which is not supported. This is most likely due to Touchable.longPressDelayTimeout not being cancelled.

https://github.com/facebook/react-native/issues/5823

這是開啟了Debug JS Remotely模式

react-native常見錯誤整理