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

相关文章
相关标签/搜索