facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.26k stars 24.34k forks source link

react-native-xcode error after upgrading to 0.46 #14935

Closed scerelli closed 7 years ago

scerelli commented 7 years ago

Environment

react-native:

⇒  react-native -v
react-native-cli: 2.0.1
react-native: 0.46.1

node: v8.1.3 npm: 5.0.3 yarn: 0.27.5

  1. Target Platform: iOS
  2. Development Operating System: macOS Sierra
  3. Build tools: Xcode 8.3.3

Steps to Reproduce

  1. Project with RN 0.44
  2. yarn upgrade --latest
  3. react-native-git-upgrade
  4. react-native run-ios

Expected Behavior

Expect my project to build

Actual Behavior

After upgrading to RN 0.46 from 0.44 i tried to run the project by using react-native run-ios but it fails building it with this error:

react-native run-ios produce this error:

    export WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES=NO
    export XCODE_APP_SUPPORT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Xcode
    export XCODE_PRODUCT_BUILD_VERSION=8E3004b
    export XCODE_VERSION_ACTUAL=0833
    export XCODE_VERSION_MAJOR=0800
    export XCODE_VERSION_MINOR=0830
    export XPCSERVICES_FOLDER_PATH=myApp.app/XPCServices
    export YACC=yacc
    export arch=x86_64
    export variant=normal
    /bin/sh -c /Users/vood/dev/myApp/ios/build/Build/Intermediates/myApp.build/Debug-iphonesimulator/myApp.build/Script-00DD1BFF1BD5951E006B06BC.sh

/Users/vood/dev/myApp/ios/build/Build/Intermediates/myApp.build/Debug-iphonesimulator/myApp.build/Script-00DD1BFF1BD5951E006B06BC.sh: line 3: ../node_modules/react-native/packager/react-native-xcode.sh: No such file or directory

** BUILD FAILED **

The following build commands failed:

    PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images build/Build/Intermediates/myApp.build/Debug-iphonesimulator/myApp.build/Script-00DD1BFF1BD5951E006B06BC.sh
AndrewJack commented 7 years ago

change ../node_modules/react-native/packager/react-native-xcode.sh to ../node_modules/react-native/scripts/react-native-xcode.sh

tigerohuang commented 7 years ago

I met the same problem.

Mark-Fulton commented 7 years ago

Same problem here as well, However I have moved the react-native-xcode.sh file to the new scripts file created and still face the same error.

react-native-cli: 2.0.1 react-native: 0.46.1

node: v8.1.3 npm: 5.0.3 yarn: 0.27.5

sandinosaso commented 7 years ago

Thank you @AndrewJack suggestion of moving the react-native-xcode.sh script to a different folder worked, however I am wondering, why is this required? I mean is this just a workaround right? Thank you

AndrewJack commented 7 years ago

@sandinosaso sorry I should have been clearer.

Open in Xcode -> Select your Project -> "Build Phases" tab -> "Bundle React Native code and images"

Then change the above paths.

bitfabrikken commented 7 years ago

@AndrewJack thanks, works for me!

itinance commented 7 years ago

+1 @AndrewJack thx!

dzpt commented 7 years ago

@AndrewJack I'm having the same trouble but with this error: ./node_modules/react-native/scripts/react-native-xcode.sh: No such file or directory , couldn't search for Bundle React Native code and images

andrewdacenko commented 7 years ago

@Tom29 in case you've initiated project with react-native 0.46 and then downgraded dependency to 0.45 - you need to change in your ios/${Project}.xcodeproj/project.pbxproj next lines:

alainib commented 7 years ago

thanks @andrewdacenko i upgrade from 0,45 to 0,46 and get the same errors, ( why they renamed the folder ??? )

you need to change in your ios/${Project}.xcodeproj/project.pbxproj next lines:

tired of react native & npm. each time I add a package i get multiple problems for compiling, missing files etc....

EDIT : i clean the project before re compile it after modification and the error come back again, so i have to make this change each times ??

Niranjan-B commented 7 years ago

I too had the same problem when upgrading from 0.44 to 0.45. A simple solution (hacky one though) was to create a new project using "react-native init", navigate to node-modules/react-native , copy the scripts folder and paste it into your actual project's node-module/react-native/ directory. Clean and re-build. This worked out for me !

njt1982 commented 7 years ago

Tip:

$ git grep 'react-native/packager'
ios/RPOJECT.xcodeproj/project.pbxproj:1530:                    shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
woshizhoujie commented 7 years ago

image

valinaga commented 7 years ago

same thing for me. the Bundle React Native code and images phase vanished. so the above almost worked for me. But I'm on RN 0.47.2 so export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh use script instead of packager to avoid script error. hope this helped.

nadirHomeFriend commented 7 years ago

iam having a bit problem your help would be appreciated . iam having problem when releasing my iOS application . with my simulator every thing is okay i can build the app but when releasing i am having freeze with white screen after passing the splash screen . in android cam not having this issue . dam using the same steps of build in production as @scgough : in the project folder in Terminal run react-native bundle --platfrom ios --dev false --entry-file index.ios.js --bundle-output main.jsbundle Drag the reference to the main.jsbundle file into XCode under myapp folder In XCode, open AppDelegate.m and uncomment jsCodeLocation = [[NSBundle mainBundle]… Open Product > Scheme > Edit Scheme then change Build Configuration to Release Select myapp under the project navigator and then: under TARGETS: myappTests > Build Phases > Link Binary With Libraries press + select Workspace > libReact.a and Add compile in XCode with the ../node_modules/react-native/scripts/react-native-xcode.sh

very thing is okay in debug mode even with real device , all my provisioning profil are Okay i really need help it is blocking me . "@expo/ex-navigation": "^3.1.0", "assert": "^1.4.1", "babel-preset-react-native-stage-0": "^1.0.1", "bamlab-react-native-smooch": "^0.3.0", "base-64": "^0.1.0", "browserify-zlib": "^0.1.4", "bytebuffer": "^5.0.1", "console-browserify": "^1.1.0", "constants-browserify": "^1.0.0", "dns.js": "^1.0.1", "domain-browser": "^1.1.7", "events": "^1.1.1", "https-browserify": "0.0.1", "install": "^0.10.1", "lodash": "^4.17.4", "mockdate": "^2.0.2", "moment": "^2.19.1", "net": "^1.0.2", "numeral": "^2.0.4", "path-browserify": "0.0.0", "process": "^0.11.10", "prop-types": "^15.6.0", "querystring": "^0.2.0", "querystring-es3": "^0.2.1", "react": "16.0.0", "react-native": "0.49.3", "react-native-crypto": "^2.1.1", "react-native-datepicker": "^1.6.0", "react-native-drawer-layout": "^1.3.2", "react-native-fbsdk": "^0.6.3", "react-native-fetch-blob": "^0.10.8", "react-native-form-idable": "^1.0.2", "react-native-gcm-android": "^0.2.0", "react-native-google-analytics-bridge": "^5.0.1", "react-native-http": "github:tradle/react-native-http#834492d", "react-native-i18n": "^1.0.0", "react-native-level-fs": "^3.0.0", "react-native-linear-gradient": "^2.3.0", "react-native-md5": "^1.0.0", "react-native-os": "^1.1.0", "react-native-push-notification": "^3.0.0", "react-native-randombytes": "^3.0.0", "react-native-root-siblings": "^1.2.1", "react-native-root-toast": "^1.3.0", "react-native-svg": "^5.4.2", "react-native-swipeout": "^2.2.2", "react-native-swiper": "^1.5.13", "react-native-system-notification": "^0.2.1", "react-native-tcp": "^3.3.0", "react-native-udp": "^2.2.0", "react-native-vector-icons": "^4.4.2", "react-redux": "^5.0.6", "react-static-container": "^1.0.1", "readable-stream": "^1.0.33", "redux": "^3.6.0", "redux-enhancer-react-native-appstate": "^0.1.1", "redux-logger": "^2.7.4", "redux-persist": "^4.4.1", "redux-saga": "^0.14.3", "stream-browserify": "^1.0.0", "superagent": "^3.3.2", "timers-browserify": "^1.4.2", "tty-browserify": "0.0.0", "url": "^0.10.3", "victory-native": "^0.15.0", "vm-browserify": "0.0.4" appdelegate.m:

naveenkapoorRH commented 6 years ago

I am using 0.50 and its moved to export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh

Is there ever gonna be stability in RN?

jrbauer88116 commented 6 years ago

@AndrewJack So pressed for time right now and your solution has saved me twice in the last couple months. Thank you!

rishiankush92 commented 6 years ago

Same issue while downgrading from 0.51 to 0.45 in 0.51

export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh

is already there in build phases

wikieswan commented 6 years ago

@andrewdacenko it works for me ,thx!

dnhyde commented 6 years ago

If someone still has this issue, check that the export NODE_BINARY path is correct. I had to install react-native and link it with the "--save" option. in your root folder run: npm install --save react-native and then the default path on xcode: export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh works.

jqn commented 6 years ago

@woshizhoujie solution worked for me