react-native 打包常見報錯和解決方案

Q1.0

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
複製代碼

解決方案javascript

下載jdk1.8.0 設置JAVA_HOME環境變量java


Q1.1:

error: Build input file cannot be found: '/${your path}/node_modules/react-native/third-party/double-conversion-1.1.5/src/double-conversion.cc'node

解決方案react

運行如下命令,注意 glog 必須是當前版本,不然找不到android

$ cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../ $ cd node_modules/react-native/third-party/glog-0.3.4/ && ../../scripts/ios-configure-glog.sh && cd ../../../../ios

詳見github issuegit

————github

Q1.2

Could not find iPhone 6 simulatorreact-native

解決方案xcode

找到並修改項目下 /node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js 文件

// 找到這行
    if (version.indexOf('iOS') !== 0) {
      continue;
    }

    // 改成這行
    if (version.indexOf('iOS') !== 0 && !version.includes('iOS')) {
      continue;
    }

複製代碼

————

Q1.3:

error: Can't find 'node' binary to build React Native bundle

解決方案

在 xcode 裏 'Build Phases' - 'Bundle React Native code and images', 把當前環境變 量添加進去 export NODE_BINARY=/Users/gridsum/.nvm/versions/node/v8.9.0/bin/node

————

Q1.4:

Could not list contents of '/${yourpath}/node_modules/react-native/scripts/third-party/glog-0.3.4/test-driver'.

Couldn't follow symbolic link.

解決方案

運行

unlink ./node_modules/react-native/scripts/third-party/glog-0.3.4/test-driver

相關文章
相關標籤/搜索