我正在尝试在Os X CircleCI框上构建React Native应用程序。
我的circle.yml如下:
machine:
xcode:
version: 8.3.3
environment:
PATH: '$PATH:$HOME/node/node-v4.4.3-darwin-x64/bin'
dependencies:
pre:
- brew install node
- npm install -g react-native-cli
- npm install
- react-native link
test:
override:
- set -o pipefail && xcodebuild -project 'ios/myApp.xcodeproj' -scheme 'myApp' clean build test -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=9.0,name=iPhone 6' CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE= | tee $CIRCLE_ARTIFACTS/xcode_raw.log | xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml
哪个失败了:
/Users/distiller/my-app/ios/myApp/AppDelegate.m:12:9: 'React/RCTBundleURLProvider.h' file not found
#import <React/RCTBundleURLProvider.h>
我的package.json如下:
{
"name": "myApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"test-watch": "jest --watch",
"test-coverage": "jest --coverage"
},
"dependencies": {
"@turf/circle": "^4.5.2",
"@turf/envelope": "^4.5.2",
"@turf/helpers": "^4.5.2",
"gl-react-native": "^2.42.3",
"react": "~15.4.0-rc.4",
"react-addons-test-utils": "^15.4.2",
"react-dom": "^15.6.1",
"react-native": "0.39.2",
"react-native-config": "0.5.0",
"react-navigation": "^1.0.0-beta.11",
"react-test-renderer": "^15.6.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.0.0",
"enzyme": "^2.9.1",
"enzyme-to-json": "^1.5.1",
"jest": "20.0.4"
},
"rnpm": {
"assets": [
"assets/fonts"
]
},
"jest": {
"preset": "react-native",
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"coverageDirectory": "__coverage__",
"snapshotSerializers": [
"./node_modules/enzyme-to-json/serializer"
],
"transformIgnorePatterns": [
"node_modules/(?!react-native|native-base|react-navigation|react-native-fabric)"
],
"setupFiles": [
"./test-setup.js"
]
}
}
通过运行启用了ssh的构建并检查版本,我可以说react-native-cli安装在2.0.1
有趣的是,当我的机器(localhost)上构建项目(使用完全相同的命令)时,此行为不会显示
通过Google搜索,我找到了类似:React Native 0.40.0 : RCTBundleURLProvider.h” file not found - AppDelegate.m
的内容完全描述我的问题,但是他们都限于RN 4.0,而我的package.json明确地固定在3.9.2
非常感谢任何帮助!
答案 0 :(得分:0)
解决方案似乎是删除我的ios/build
目录。一旦我这样做,我开始在本地使用与CircleCi相同的行为(我可以通过简单地从导入路径中取出React
来解决这个问题:
#import <RCTBundleURLProvider.h>
答案 1 :(得分:0)
我遇到了这个问题,因为我的测试脚本没有运行yarn install
。因此,新的克隆和构建将失败。您可以在config.yml
文件中添加以下内容:
- run:
name: Install React Native
command: yarn install