最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】react-native-navigation的example出错:boost/iterator/iterator_adaptor.hpp file not found

React Native crifan 2201浏览 0评论

网上下载了个

react-native-navigation

参考:

react-native-navigation/example at master · wix/react-native-navigation

去试试example的效果如何。

然后去运行:

结果出错:

‘boost/iterator/iterator_adaptor.hpp’ file not found

搜:

‘boost/iterator/iterator_adaptor.hpp’ file not found

参考:

解决 ‘boost/iterator/iterator_adaptor.hpp’ file not found’ 及控制台”:CFBundleIdentifier”, Does Not Exist – 你就是个演员 – 博客园

解决 ‘boost/iterator/iterator_adaptor.hpp’ file not found’ 及控制台”:CFBundleIdentifier”, Does Not Exist – qianzhihe1992110的专栏 – CSDN博客

React Native开发错误警告处理总结(已解决 !持续更新) – 简书

React Native异常 – liufu0215的博客 – CSDN博客

‘boost/iterator/iterator_adaptor.hpp’ file not … – 简书

解决React Native 运行在ios上报’boost/iterator/iterator_adaptor.hpp’ file not found’错误 – 阿钟的博客 – CSDN博客

React Native异常 – iPhone手机开发技术文章 – 红黑联盟

搜:

boost 库

BOOST库介绍,安装 – coder – CSDN博客

Boost Downloads

暂时不想去尝试:直接下载boost然后覆盖(即使可以解决问题)

而是想要搞清楚,为何此处的react的系统没有自动下载合适的boost库,而导致缺少头文件的问题。

/Users/crifan/dev/dev_root/ReactiveNative/lib/react-native-navigation/package.json

{
  “name”: “react-native-navigation”,
  “version”: “1.1.85”,
  “description”: “React Native Navigation – truly native navigation for iOS and Android”,
  “license”: “MIT”,
  “nativePackage”: true,
  “author”: “Tal Kol <[email protected]>”,
  “publishConfig”: {
    “registry”: “https://registry.npmjs.org/”;
  },
  “bugs”: {
    “url”: “https://github.com/wix/react-native-navigation/issues”;
  },
  “homepage”: “https://github.com/wix/react-native-navigation”;,
  “readme”: “https://github.com/wix/react-native-navigation#readme”;,
  “repository”: {
    “type”: “git”,
    “url”: “https://github.com/wix/react-native-navigation.git”;
  },
  “main”: “src/index.js”,
  “scripts”: {
    “build”: “:”,
    “lint”: “eslint src test”,
    “test:js”: “jest –coverage”,
    “test:android”: “cd android && ./gradlew clean testDebugUnitTest”,
    “test:ios”: “:”,
    “pretest”: “npm run lint”,
    “test”: “npm run test:js && npm run test:android && npm run test:ios”,
    “test:watch”: “jest –coverage –watch”,
    “release”: “node ./scripts/release.js”
  },
  “peerDependencies”: {
    “react”: “*”,
    “react-native”: “*”
  },
  “dependencies”: {
    “lodash”: “4.x.x”
  },
  “devDependencies”: {
    “babel-cli”: “6.x.x”,
    “babel-core”: “6.x.x”,
    “babel-eslint”: “7.x.x”,
    “babel-jest”: “18.x.x”,
    “babel-polyfill”: “6.x.x”,
    “babel-preset-react-native”: “1.x.x”,
    “babel-register”: “6.x.x”,
    “eslint”: “3.x.x”,
    “eslint-plugin-babel”: “3.x.x”,
    “eslint-plugin-react”: “6.x.x”,
    “eslint-plugin-react-native”: “2.x.x”,
    “jest”: “18.x.x”,
    “jest-cli”: “18.x.x”,
    “jest-react-native”: “18.x.x”,
    “prop-types”: “^15.5.10”,
    “react”: “16.0.0-alpha.6”,
    “react-native”: “0.43.0”,
    “react-test-renderer”: “15.4.2”,
    “semver”: “5.x.x”
  },
  “jest”: {
    “preset”: “jest-react-native”,
    “testPathDirs”: [
      “node_modules”,
      “src2”
    ],
    “resetMocks”: true,
    “resetModules”: true
  }
}

其中:

    “react”: “16.0.0-alpha.6”,

    “react-native”: “0.43.0”,

    “react-test-renderer”: “15.4.2”,

感觉或许是版本旧了?

看到有人提到了:

react-native upgrade

所以去搜搜看看:

react-native upgrade

React-Native版本升级的实践方案 – CSDN博客

去试试

但是先去看看版本:

➜  react-native-navigation git:(master) ✗ react-native
You did not pass any commands, run `react-native –help` to see a list of all available commands.
➜  react-native-navigation git:(master) ✗ react-native –help
  Usage: react-native [command] [options]
  Commands:
    init <ProjectName> [options]  generates a new project and installs its dependencies
  Options:
    -h, –help    output usage information
    -v, –version output the version number
➜  react-native-navigation git:(master) ✗ react-native -v
react-native-cli: 2.0.1
react-native: n/a – not inside a React Native project directory
➜  react-native-navigation git:(master) ✗ cd example
➜  example git:(master) ✗ react-native -v
react-native-cli: 2.0.1
react-native: 0.45.1
➜  example git:(master) ✗ pwd
/Users/crifan/dev/dev_root/ReactiveNative/lib/react-native-navigation/example

所以此处有点奇怪:

react-native-navigation中的package.json指定了react-native的版本是0.43.0

但是此处的

react-native-navigation的example中检测出来的react-native的版本是0.45.1

不过才看懂是:

/Users/crifan/dev/dev_root/ReactiveNative/lib/react-native-navigation/example/package.json

中指定的react-native的确是0.45.1

  “dependencies”: {
    “react”: “16.0.0-alpha.12”,
    “react-native”: “0.45.1”,
    “react-native-animatable”: “^1.1.0”,
    “react-native-navigation”: “latest”
  },

所以也是对的。

去尝试解压本地的rncache中的boost,结果出错:

【已解决】Mac中解压boost_1_63_0.tar.gz出错:tar: Error exit delayed from previous errors

然后去替换掉之前出错的文件:

即可看到:

了。

然后即可正常编译项目了:

对应的效果是:

【总结】

此处只不过是之前不知道什么原因导致第三方库boost的tar包没有下载完整,导致解压后的boost文件夹中缺少了boost/iterator/iterator_adaptor.hpp,所以报错。

解决办法是:

直接去下载对应的boost_1_63_0.tar.gz:

https://dl.bintray.com/boostorg/release/1.63.0/source/boost_1_63_0.tar.gz

解压后,放到对应路径:

react-native-navigation/example/node_modules/react-native/third-party/boost_1_63_0

下,即可。

注:此处和React-native的版本没有关系。

且注意到:react-native-navigation的package.json中依赖的

“react”: “16.0.0-alpha.6”,

“react-native”: “0.43.0”,

而:

react-native-navigation/example/package.json

中依赖的是:

“react”: “16.0.0-alpha.12”,

“react-native”: “0.45.1”,

即两者依赖的react和react-native的版本还不一样,是正常的(作者故意为之的?)

转载请注明:在路上 » 【已解决】react-native-navigation的example出错:boost/iterator/iterator_adaptor.hpp file not found

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.170 seconds, using 22.08MB memory