react-native: After upgrading to react-native 0.59 iOS build fails
đ Bug Report
After updating to react-native 0.59 and trying to build the app for iOS I get the following error:
Build input file cannot be found: â/app/node_modules/react-native/ReactCommon/yoga/yoga/YGFloatOptional.cppâ
Whatâs strange to me is, that I canât find this file here either in the current master: react-native/tree/master/ReactCommon/yoga/yoga
(only YGFloatOptional.h
)
To Reproduce
We upgraded a mid sized project from 0.57.7 â 0.59.
Expected Behavior
Build should run through just fine like it did before.
Environment
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 2.95 GB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.1 - /var/folders/1r/ymkpxdlj21lb638kzp4jxvwm0000gn/T/yarn--1552463658468-0.20119758467048565/node
Yarn: 1.13.0 - /var/folders/1r/ymkpxdlj21lb638kzp4jxvwm0000gn/T/yarn--1552463658468-0.20119758467048565/yarn
npm: 6.4.1 - /usr/local/Cellar/node@10/10.15.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 24, 25, 27, 28
Build Tools: 23.0.1, 23.0.3, 24.0.1, 25.0.0, 27.0.3, 28.0.3
System Images: android-24 | ARM 64 v8a, android-24 | ARM EABI v7a, android-24 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5264788
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.0 => 0.59.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 105
- Comments: 69 (3 by maintainers)
Links to this issue
Commits related to this issue
- chore(upgrade) upgrade to React 16.8.4 and React Native 0.59.1 iOS issue and fix: https://github.com/facebook/react-native/issues/23886#issuecomment-474338322 Android issue and fix: https://github.c... — committed to reflex-ui/reflex-ui by flsilva 5 years ago
- chore(upgrade) upgrade to React 16.8.4 and React Native 0.59.1 iOS issue and fix: https://github.com/facebook/react-native/issues/23886#issuecomment-474338322 Android issue and fix: https://github.c... — committed to reflex-ui/reflex-ui by flsilva 5 years ago
I got the same issueâŚ, Every time there is some issue with upgrades in react native so tiredâŚ
@jvandenaardweg I think youâre right that itâs a caching issue.
For me what worked was deleting my Xcodeâs derived data folder and restarting Xcode.
rm -rf ~/Library/Developer/Xcode/DerivedData
Once I restarted, I attempted a build and it failed and prompted me to close and reopen my xcode workspace. Once I did that, I tried to build again and it worked.
Add these lines to your Podfile:
and run
none of them worked
I have just reproduced this issue with XCode: 10.1 and RN 0.59.0.
EDIT 1: I could reproduce with XCode UI build tool ; but itâs working fine with
react-native run-ios
(make sure to have the latest 2.x cli).EDIT 2: I managed to make it work with XCode 10.1 by enabling legacy build. Related to #19573
Every time I encounter a hair-pulling issue with RN giving me some nonsense error message, I go on a desperate github hunt for solutions. Most of the time the solution is delete cache, delete derived data, reopen Xcode, clear build folders etc. Over the years Iâve put together this bash script that Iâve added as an npm script in my package.json. Now my first goto solution for most issues is
npm run clear
.PS. And it solved this problem for me too đ
After using
npm audit fix
, my âreact-nativeâ are upgraded automatically to version 0.59 and I canât not build my project. Solution: Downgrade version to lower one.npm install react-native@<version>
example :npm install react-native@0.57.8
Thanks @jpudysz . Following your solution, I then get the following error: âfolly/Portability.hâ file not found in JSBundleType.h
Does anyone know whatâs going on?
Many thanks.
downgrade to
"react-native": "0.57.4",
than it works againWe know that upgrading has been a long lasting pain for the community so starting v0.59 we have introduced a new flow via the new CLI.
That said we have been writing the breaking changes in the changelog and in the releases tab so there is no real guessing needed.
Anyway, closing since this is clearly related to upgrading - also, in general you can use rn-diff-repo to check for all the necessary steps when upgrading.
I had the exact same issue. The good old
rm -rf node_modules && npm i
and cleaning the build folders did it for meI was also seeing the
#include <folly/Portability.h>
error. The issue in my case were missing subspecs in the podfile.It builds fine for me with:
in my case, Xcode just did an automatic update and produced such problem. what i did to solve the problem was: cd ios rm -fr Pods rm Podfile.lock pod install
reinstall the Pods and Podfile solved my problem
So after following the upgrade diff to 59.4 (using rn-diff-purge), I still had the same issues as everyone here (
YGFloatOptional.cpp
error first, and then thefolly/Portability.h
error). However, none of the solutions worked by itself, so this is what I did to resolve the issues:Then updated my Podfile to the following:
After that I reinstalled the pods
Only then the project started building successfully again
I gave up, I deleted all links to node_modules from Pods file then delete node_modules and build directory and re-installed anything then finally built successfully again.
This is so exhausting.
@jpudysz Yeah that worked after migrating to cocoapod and opening the XCode project with the
.xcworkspace
file. I had toreact-native unlink
andreact-native link
bridged libraries so that they use thePodfile
instead.Should legacy (no-cocoapod) linking be deprecated ?
please. downgraded Xcode 10.1
Alright folks, I think this issue is generally about build cache issues from upgrading (from reading the posts ) - so if you have issues, I think it can generally be fixed by:
rm -rf node_modules; rm -rf Pods
then re-installreact-native upgrade x.y.z
This is pretty much the same for every version, I bet. I would maybe look into making an issue on the react-native-cli about improving this and maybe running some of the commands itself.
The file seems to be deleted from the yoga project since 13 Dec 2018 and âinlinedâ into
yoga/YGFloatOptional.h
: https://github.com/facebook/yoga/commit/96d93f29826257ff6e9bb6c19211adb423029c29My guess is the reference to
ReactCommon/yoga/yoga/YGFloatOptional.cpp
is not needed anymore.Removing the cache and rebuilding the project didnât work for me right away.
So I tried upgrading to React Native 0.59.1 then rebuilding the project. Also didnât work.
However, THEN cleaning my node_modules, cache and build folders and rebuilding the project, did work, using:
So, it seems cache related.
Upgrading to React Native 0.59.1 is maybe not needed, I think a part of the script did the trick for me.
Hope this helps others!
Run this command: $ conda deactivate
After trying what feels like pretty much everything, RN standard upgrade, git upgrade tool, applying diff patch I ended up recreating a completely new project and doing the extremely tedious work of rebuilding the code base. They say itâll be better from 0.59 on⌠hopefully theyâre right about that
Above solutions did not work, the following helped my project to build again.
After running these commands, I was able to build on xcode but not using
react-native run-ios
. I then ran these commands (thanks https://github.com/facebook/react-native/issues/23886#issuecomment-509528212):which helped me build using
react-native run-ios
again.Hmm, I have just upgraded from
0.58.4
to0.59
, cleaned build directories in XCode and I was able to run both debug and archive the app. I am using XCode 10.1. My upgrade strategy:Wondering if everything might work for me because I had working
0.58.4
and just applied new stuff on top of it?EDIT: I have also ran
npm ci
in order to remove mynode_modules
(just to make sure) and I was still able to build the app from XCode đ¤EDIT2: And I donât have
YGFloatOptional.cpp
:In my case i just forgot to did the step:
example
after i did that, xcode just compile ok
React Native is unsustainable, 100 resolutions offered for every bug someone encounters. One change and the entire build process, boilerplate and reason to use react native falls apart. How can companies truly add this development process to a product pipeline. ridiculous!!!
I upgraded too but with no luck so far.
None of the above worked for me
âBetween react-native 0.57.8 and 0.58.5 there is one big change that was added in the Xcode project is that you have to add JavaScriptCore.Framework to the Linked FrameWorks and Librariesâ - from here
PLUS
@jvandenaardweg answer:
Did the work for me.
Itâs really frustrating as other have said, needing to guess what its breaking a code that was working before.
Also on Android I had to upgrade Build Gradle version to work again.
Iâm getting the same issue upgrading from 0.57.8 -> 0.59.1. Looking at a fresh 0.59.1 init there is no
YGFloatOptional.cpp
file.Delete derived data cd ios remove Pods and Podfile.lock pod install
@philipaarseth I hope you ate your words when 0.60 came out đ
the right line will be:
rm -rf ~/Library/Developer/Xcode/DerivedData
Resolved with the following :
Then I reinstalled my dependencies (npm & pod) and it worked đ
I realize that my post was very unclear⌠Sorry about that. Here is the diff file that should make it more explicit for people having issue with âfolly/Portability.hâ
Try making the following modification to nodes_modules/react-native/React.podspec file, at least in my case it has worked ! I can now compile my project and launch it without problems.
Thanks, I did that and it worked again.
After using @jpudysz, @jvandenaardweg and @johnryan tips, it build for me also. Thanks guys!
Hello,
After lots of digging, Iâve managed to get why I got the issue. Cleaning the cache and everything didnât fix the problem for me and I was still having the #include <folly/Portability.h>.
It was compiling fine for the React project under my project, but failing to compile for the Pods I have.
Even after adding the Folly/glog/DoubleConversion pods, I was still having the problem.
I then amended the React.podspecs file to edit the Core subspec
After adding the Folly reference to the pod_target_xcconfig, it was compiling without any other issues.
And here is the full podfile I have