美文网首页首页投稿(暂停使用,暂停投稿)
ReactNative 0.47.2 初始化等错误解决--持续记

ReactNative 0.47.2 初始化等错误解决--持续记

作者: 永不止步123 | 来源:发表于2017-08-30 15:23 被阅读131次

最近把ReactNative项目升级到0.47.2中间遇到了一些问题,记录下来。后续会持续记录其他遇到的问题

版本

  • node -v
    v8.4.0

  • npm -v
    5.3.0

  • react-native -v
    react-native-cli: 2.0.1
    react-native: 0.47.2

步骤 - 以iOS工程为例

  1. cd YourReactNaitveProject/
  2. yarn install
  3. 打开iOS工程并编译,报错

错误集合

  1. AppDelegate.m 提示头文件找不到
  • #import <CodePush/CodePush.h> file not found
  • #import <React/RCTBundleURLProvider.h> file not found
  • #import <React/RCTRootView.h> file not found
    这是由于React工程有编译错误,导致主工程引用React工程失败。所以不用理会
  1. double-conversion shell Error
  • 打开VPN 使用全局模式
  1. third-party 'boost/iterator/iterator_adaptor.hpp' file not found
I thought I've figured out how to fix this problem.
It turns out that the node_modules/react-native/ios-install-third-party.sh did not run out right (Maybe because the network).

download files list:
https://github.com/google/glog/archive/v0.3.4.tar.gz 
https://github.com/google/double-conversion/archive/v1.1.5.tar.gz
https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz
https://github.com/facebook/folly/archive/v2016.09.26.00.tar.gz
So, I did the following steps:
0. download the files needed inside the .sh, put it in the ~/.rncache/.
0. copy the downloaded files into node_modules/react-native/third-party/, ran tar -zxf *** to each file.
0. build again, and worked for me.
  • 下载这四个文件,拷贝到~/.rncache/.
  • 再把这四个文件拷贝一份到你自己ReactNative工程中的node_modules/react-native/third-party/中,
  • cd 到这个路径下,对每个文件使用 tar -zxf 命令解压缩
  • 回到Xcode工程,Clean + Run
  1. third-party 'config.h' file not found
Running into the same issue here after upgrading from 0.44. None of the above solutions or clearing caches did the trick for me. Here's what I did to get things working again:

In the Terminal, navigate to the react-native/third-party/glog folder inside node_modules (for me, this was cd node_modules/react-native/third-party/glog-0.3.4)
Once actively in this folder, run ../../scripts/ios-configure-glog.sh
Glog is configured and the required config.h header file is created for Xcode to find
  • $cd yourProject/node_modules/react-native/third-party/glog-0.3.4
  • run $ ../../scripts/ios-configure-glog.sh
  • 回到Xcode工程, Clean + Run
  1. 运行工程模拟器显示 No bundle URL present
  • VPN选择自动代理模式

相关文章

网友评论

    本文标题:ReactNative 0.47.2 初始化等错误解决--持续记

    本文链接:https://www.haomeiwen.com/subject/fhytjxtx.html