Skip to content

RCTConvert.h yoga/Yoga.h file not found #11781

@adamgins

Description

@adamgins

I am logging this as a bug as it seems like a bunch of people have logged it as an issue on Stackoverflow ... but seems to be a bug http://stackoverflow.com/questions/41505616/yoga-yoga-h-header-file-not-found-after-react-native-integration-in-the-existing

Upgraded to latest react-native 0.4.0

Build project for iOS on Xcode and you get the error message: /Users/adamginsburg/Documents/development/buzzy9/node_modules/react-native/React/Base/RCTConvert.h:13:9: 'yoga/Yoga.h' file not found

  • React Native version: 0.4.0
  • Platform: iOS
  • Operating System: The build issue happen on XCode 8

Activity

adamgins

adamgins commented on Jan 9, 2017

@adamgins
Author
fgaleano

fgaleano commented on Jan 9, 2017

@fgaleano

I'm getting similar error messages. In my case:

  • 'React/RCTConvert.h' file not found in RCTResizeMode.h
  • 'React/RCTLog.h' file not found in RCTNetworkTask.m

I had like 5-6 more but those went away after I deleted my node_modules folders and ran npm install. These 2 remained, though, and my app won't build.

What are we missing?

julienfouilhe

julienfouilhe commented on Jan 10, 2017

@julienfouilhe

I am using react native in an already existing iOS app. Everything is working fine with 0.39.0.

When I tried updating to 0.40.0, I get this error message when compiling (RCTConvert.h yoga/Yoga.h file not found)

@emilsjolander

emilsjolander

emilsjolander commented on Jan 10, 2017

@emilsjolander
Contributor

Seems like the xcode project needs to be fixed in some way. Not really sure what could have broken this. @mmmulani Could you have a look?

JesseARWhite

JesseARWhite commented on Jan 10, 2017

@JesseARWhite

This looks like it has something to do with Cocoapods integration, @julienfouilhe @emilsjolander can you confirm if this is coming from cocoapods or not?

julienfouilhe

julienfouilhe commented on Jan 10, 2017

@julienfouilhe

@JesseARWhite I am using CocoaPods yes, but I don't know if it is responsible for the error or not. XCode is giving the error when trying to build the app.

robhogan

robhogan commented on Jan 10, 2017

@robhogan
Contributor

I think this is the same issue we had in #9544, and occurs whenever use_frameworks is enabled - essentially a framework can't include its own internal headers using angle brackets.

Because FB needed to use angle brackets for its internal builds of CSS Layout @alloy proposed a compromise which was removed in 7c91f89 . Since the move to using angle brackets everywhere, the use of RN as a framework now looks pretty much beyond repair.

AFAIK it's still possible even in a swift project to disable use_frameworks and import RN via a bridging header. It should also be possible to find+replace imports in post_install, but that's really only a brittle hack if RN has dropped support for frameworks.

julienfouilhe

julienfouilhe commented on Jan 10, 2017

@julienfouilhe

@rh389 I'm using swift and not using use_frameworks! would be painful, wouldn't it? Some of my dependencies are written in Swift.

What would need to be done in a post_install script? Changing <yoga/Yoga.h> for "yoga/Yoga.h"did not help, even when I added: ${SRCROOT}/../ios-editor/node_modules/react-native/ReactCommon to the User Header Search Paths of my project

mmmulani

mmmulani commented on Jan 10, 2017

@mmmulani
Contributor

cc @javache can you reapply for fix for the include header to yoga now?

mmmulani

mmmulani commented on Jan 10, 2017

@mmmulani
Contributor

hey everyone, I tried to repro this issue by creating a tiny project and following the Obj-C guide here: https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
but I was not able to run into the Yoga build problem.

does anyone have a smaller repro case they could post?

robhogan

robhogan commented on Jan 10, 2017

@robhogan
Contributor

I'll see if I can post a repro case tomorrow, I did reproduce the issue earlier - in the meantime have you tried enabling use_frameworks, even in Objective-C? I haven't yet been able to get that working as a minimal build in a new app at all without modifying RN.

Edit: (Back at the mac) - repro case now up

git clone https://github.com/rh389/rn-framework-demo
cd rn-framework-demo
yarn install
open FrameworkDemo.xcworkspace

That was created simply by creating a new single-page ObjC app with the XCode wizard, then yarn add react-native react, adding a Podfile as in the repo, and pod install.

Attempting to build that in XCode should allow you to reproduce the yoga/Yoga.h not found immediate issue. It is possible to add [...]/ReactCommon recursive to the project's header search paths in order for Yoga.h to be found, but then the issue is eg #import <yoga/Yoga.h>: RCTConvert.h:13:9: Include of non-modular header inside framework module 'React.RCTConvert' - that's the more fundamental problem once you've got beyond search paths - as discussed in #9544 (and as far as I understand it - no expert) framework modules can have dependencies on their own internal headers or on other framework modules, but not on arbitrary, potentially external libraries.

I don't know of a way to overcome this while the #import style is what it is across RN.

julienfouilhe

julienfouilhe commented on Jan 11, 2017

@julienfouilhe

Hi @mmmulani I also created a simple swift project, with all the files already in the repo, so all you have to do is launch the xcworkspace in xcode and try to build: https://github.com/julienfouilhe/test-yoga-file-not-found

Thanks!

What is weird too is the directories architecture:
screen shot 2017-01-11 at 1 36 18 pm

mmmulani

mmmulani commented on Jan 19, 2017

@mmmulani
Contributor

@javache and I found a workaround to this problem and we'd like someone from the community to champion it and support it going forward.

we created a yoga.podspec at node_modules/react-native/ReactCommon/yoga with contents:

Pod::Spec.new do |s|
  s.name                = "yoga"
  s.source_files = '**/*.{c,h}'
  s.header_dir   = 'yoga'
  s.platform            = :ios, "8.0"
  s.author = ''
  s.license = 'a'
  s.homepage = 'a'
  s.source = { :path => '.' }
  s.summary = 'a'
  s.version = '0.1'
end

and then include it from the main Podfile with pod 'yoga', :path => './node_modules/react-native/ReactCommon/yoga'

you would have to make another one for jschelpers and possibly any other subspec we have that uses a different header search path.

but this seems like a bug in CocoaPods, it should let use create the React dependency and link all its subspecs statically but create the whole React dependency as a dylib. cc @alloy for any ideas here

Aleksandern

Aleksandern commented on Jan 20, 2017

@Aleksandern

@mmmulani
It looks like it doesn't work in my case
I still have have an error

RCTConvert.h:13:9: fatal error: 'yoga/Yoga.h' file not found
#import <yoga/Yoga.h>

Podfile

platform :ios, '8.0'
use_frameworks!

target 'app' do
pod 'React', path: '../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
`pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
end

But I had to change pod 'yoga', :path => './node_modules/react-native/ReactCommon/yoga' to pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

"react": "15.4.2",
"react-native": "0.40.0",

83 remaining items

added a commit that references this issue on Apr 26, 2017
3c6c571
gotoAndBliss

gotoAndBliss commented on May 19, 2017

@gotoAndBliss

This error occurs again on a fresh install of react-native: 0.44.0

quantuminformation

quantuminformation commented on May 19, 2017

@quantuminformation
Contributor

@gotoAndBliss try deleting your ios build folder

cliren

cliren commented on Jun 12, 2017

@cliren

I am running into the following error and have setup a simple example for anyone to advise what's going wrong here: https://github.com/cliren/RNIntegration.

Using cocopods version: 1.1.1 (can't upgrade due to exiting app's dependency). Appreciate any help!

RNIntegration/js/node_modules/react-native/React/Modules/RCTDevSettings.mm:16:9: fatal error: 'jschelpers/JavaScriptCore.h' file not found
#import <jschelpers/JavaScriptCore.h>
        ^
1 error generated.

tmaly1980

tmaly1980 commented on Jun 13, 2017

@tmaly1980

I had a similar issue with yoga/Yoga.c, and fixed it by running react-native link

cliren

cliren commented on Jun 13, 2017

@cliren

@tmaly1980 I tried your suggestion on https://github.com/cliren/RNIntegration but still ran into the same issue. I am using the below dependencies, may I know what versions are you using?

"react": "16.0.0-alpha.12",
"react-native": "0.45.1"
tmaly1980

tmaly1980 commented on Jun 13, 2017

@tmaly1980
cliren

cliren commented on Jun 14, 2017

@cliren

@tmaly1980 I tried 0.42.3 and 15.4.1 but still get the same error. It looks very fragile unless I am missing something basic. Would you mind checking if I am missing anything here: https://github.com/cliren/RNIntegration?

react-native-cli: 2.0.1
react-native: 0.42.3
tmaly1980

tmaly1980 commented on Jun 14, 2017

@tmaly1980
samthui

samthui commented on Sep 11, 2017

@samthui

After upgrading from RN 0.42.3 to 0.43.3, I got similar issue with RCTDevMenu, though I'm sure these file exist.
My project also uses CocoaPods for iOS project. After re-running pod install and restart MAC, it works normally.
I noticed that in terminal console of pod install, it logged:

Installing React 0.43.3 (was 0.42.3)
Installing Yoga 0.43.3.React (was 0.42.3.React)

(Thanks to that I know that CocoaPods need to re-config RN dependency by running pod install, previously I thought that CocoaPods only needs to be configured once and use path to its dependencies all afterwards.)

brenordr

brenordr commented on Oct 21, 2017

@brenordr

For the ones having this issue with RN 0.47 or above,
I've discovered that it appear in a project I'm working after change the disk to case sensitive.
CocoaPods seems name the Yoga project as <Yoga/Yoga.h> not <yoga/Yoga.h>

Revert the disk fixed (at least locally) the issue.

locked as resolved and limited conversation to collaborators on May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @alloy@notjosh@gotoAndBliss@mmmulani@quantuminformation

      Issue actions

        RCTConvert.h yoga/Yoga.h file not found · Issue #11781 · facebook/react-native