New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<React/RCTLog.h> <React/RCTBridge.h> are not found since I upgrade react-native to 0.40 #12042

Closed
Phenek opened this Issue Jan 23, 2017 · 50 comments

Comments

Projects
None yet
@Phenek

Phenek commented Jan 23, 2017

Hello guys,

<React/RCTLog.h> <React/RCTBridge.h> are not found since I upgrade react-native to 0.40
Sometimes also <React/RCTEventEmitter.h> is not found.

I tried
_"react-native-git-upgrade"
_"rm -rf node_modules/"
_"watchman watch-del-all"
_"rm -fr $TMPDIR/react-*"
_"npm i"

But the build still Fail :-(

@CapitanRedBeard

This comment has been minimized.

CapitanRedBeard commented Jan 23, 2017

In addition to those above I will sometimes get React/RCTViewManager.h not found in RCTRawTextManager.h on line 10 #import <React/RCTViewManager.h>.
This is confusing since I changed all of my RCT includes to have the <React/ prefix, but these errors seem to be occurring in the React library.

Could this possibly be 3rd party library related? The errors never occur in a dependency library. Or possibly react-native-git-upgrade is not fully changing everything. I've tried to get this working with a manual upgrade and still have troubles

Did all the steps above plus react-native link still nothing. Also deleted DerivedData cache.

react-native: 0.40.0
react: 15.4.2
react-native-cli: 2.0.1
npm: 3.10.7

EDIT
The only 3rd party iOS dependencies I have are:
react-native-blur(1.3),
react-native-linear-gradient(2.0),
react-native-vector-icons(4.0)

which all have been updated for 0.40 RN. I'm not able to get a new repo to upgrade to v0.40 with react-native-git-upgrade

@laclance

This comment has been minimized.

laclance commented Jan 24, 2017

same issue here

@Phenek

This comment has been minimized.

Phenek commented Jan 24, 2017

In addition on RCTLocationObserver.m:10
10:9: fatal error: 'React/RCTEventEmitter.h' file not found
#import <React/RCTEventEmitter.h>
^
1 error generated.
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Hope you can help us :-)
Regards,

@ghost

This comment has been minimized.

ghost commented Jan 24, 2017

same problem here, this issue gives some advice but nothing worked for me #11721

@Phenek

This comment has been minimized.

Phenek commented Jan 24, 2017

Hello guys,

I solved it by disabling parallelization but I don't know if it's a good thing.
The packager is slow enough, and I think it's slow down xcode too.
I really dont think this should be turned off. But you can try by doing this:
(From badasve Source: #11721)

  • In Xcode, go to the project scheme (Product -> Scheme -> Manage Scheme -> double click your project).

  • Click on the 'Build' option at the left pane.

  • Uncheck 'Parallelize Build' under Build Options.

  • Then in Targets section, click '+' button then search for 'React'. Select it and click 'Add'.
    'React' should now appear under Targets section. Click and drag it to the top so that it will be the first item in the list (before your project).

  • Clean the project and build.

EDIT:
I tried to selected back the parallelize Build

but this error is back! Don't know what to do..:
#import <React/RCTBridgeModule.h>
^
1 error generated.
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

@CapitanRedBeard

This comment has been minimized.

CapitanRedBeard commented Jan 24, 2017

I've followed the above advice ^ and still not getting anything. I believe that fix aims to disable parallelization so the React package can compile first. However it is not solving the problem for me. @oblador If this is a bug do we have a ticket I can refer to?

So I've removed my Xcode, deleted derivedData, reset my computer, installed a new Xcode project, react-native init'd a new project and built it and I still get this error. Pretty lost at this point 😞

@LoopIndigo

This comment has been minimized.

LoopIndigo commented Jan 25, 2017

Try the following:

  1. Clean (cmd+shift+K)
  2. Build core React - select React as the scheme in Xcode and build it (cmd+B)
  3. Build the library that is failing (e.g. RCTText).
  4. Build your app.
@badaz

This comment has been minimized.

badaz commented Jan 25, 2017

I was upgrading from 0.33, so I settled on using to 0.39 for now, I guess I'll wait until this headers change is not so new anymore

@Phenek

This comment has been minimized.

Phenek commented Jan 25, 2017

Thanks LoopIndigo!

Now I can compile on Xcode, but when I compile from the Terminal with
"react-native run-ios"
The Build still Fail

** BUILD FAILED **

The following build commands failed:
CompileC PATH/ios/build/Build/Intermediates/RNGL.build/Debug-iphonesimulator/RNGL.build/Objects-normal/x86_64/RCTConvert+CaptureConfig.o RCTConvert+CaptureConfig.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

@LoopIndigo

This comment has been minimized.

LoopIndigo commented Jan 25, 2017

@clovs glad to hear it works. I don't use run-ios and just stick to Xcode (my reason was more around the capability of run-ios to handle projects in sub-directories) so I can't be much help there.

Are you fine with sticking to XCode or is run-ios a blocker for you?

@Phenek

This comment has been minimized.

Phenek commented Jan 25, 2017

Yeah I'm fine for now with Xcode
Thanks again :-)

@Phenek Phenek closed this Jan 25, 2017

@OpakAlex

This comment has been minimized.

OpakAlex commented Jan 25, 2017

@clovs thanks you man!

@Phenek

This comment has been minimized.

Phenek commented Jan 25, 2017

не за что )))

@OpakAlex

This comment has been minimized.

OpakAlex commented Jan 25, 2017

@clovs сколько же ты времени потратил на магический фикс с порядком компиляции?))))

@Phenek

This comment has been minimized.

Phenek commented Jan 25, 2017

With the help of @LoopIndigo @badasve in two days the issue was solved.

@OpakAlex

This comment has been minimized.

OpakAlex commented Jan 25, 2017

;)

@rpylipow

This comment has been minimized.

rpylipow commented Jan 25, 2017

@LoopIndigo's solution worked for solving the majority of my issues - Thanks!

My React scheme builds without any issues, but I'm seeing an error regarding RCTEventEmitter within React.

screen shot 2017-01-25 at 12 01 34 pm

Any ideas?

@ms88privat

This comment has been minimized.

ms88privat commented Jan 26, 2017

Have the same problems with 41-rc. This issue should be open!

#12077

@Phenek Phenek reopened this Jan 26, 2017

@rh389

This comment has been minimized.

Contributor

rh389 commented Jan 27, 2017

@rpylipow Make sure you don't have any #import "RCTEventEmitter.h" directives either in your own project or in any third-party native modules you might be using (inside React itself is ok). Change them to #import <React/RCTEventEmitter.h>.

That error appears when a header is being imported in both different ways somewhere across the build.

@Msspl-PrashenjeetRoy

This comment has been minimized.

Msspl-PrashenjeetRoy commented Feb 1, 2017

@LoopIndigo what do you mean by 3rd no point:
Build the library that is failing (e.g. RCTText). (?)

My was failing in AppDelegate.m file :
#import "AppDelegate.h"

#import "RCTBundleURLProvider.h" (file not found)
#import "RCTRootView.h" (file not found)

@Phenek

This comment has been minimized.

Phenek commented Feb 1, 2017

For my part, I just recreated a new project with 0.40.
copy and past all src/, reinstall all third party libraries.
After that all errors was out.

I suggested you to do the same, to resolve this issue faster.

@Phenek Phenek closed this Feb 1, 2017

@Msspl-PrashenjeetRoy

This comment has been minimized.

Msspl-PrashenjeetRoy commented Feb 1, 2017

ok I will follow your suggestion but it really taking time again setting up all libraries again and including fonts etc :( ... but is there any solution with 0.39.0 version. ????? Now I have 0.39 version.

@freakinruben

This comment has been minimized.

freakinruben commented Feb 7, 2017

For me, after days of struggling, several things were required to get 0.40/0.41 working:

  1. As described in this comment, make sure Dead code stripping is set to No for all build targets

  2. Make sure that in your release-schema in the run-job, the Build Configuration is set to Debug (not release or whatever)

  3. Remove these headers from HEADER_SEARCH_PATHS in all your build-configurations:

    • "$(SRCROOT)/../node_modules/react-native/React/**",
    • "$(SRCROOT)/../node_modules/react-native/ReactCommon/**",
@geekvijay

This comment has been minimized.

geekvijay commented Apr 21, 2017

@RajanPN You saved my day :)

@onpaws

This comment has been minimized.

onpaws commented Apr 21, 2017

Just wanted to follow up to how I resolved the Packager issue I noticed while doing the RN upgrade.
My project folder had a '+' in the path, and after a lot of frustration on a hunch I tried moving to a path with only 'normal' Roman characters.
Before:
/Users/me/projects/+client/app/
After:
/Users/me/projects/client/app/

This actually fixed the Packager issues mentioned above.
Just sharing in case it helps someone else.

@ezos86

This comment has been minimized.

ezos86 commented Apr 30, 2017

@clovs wtf - not sure why that worked, I literally added a library, and then removed it but still had issue, before I added that library, everything was fine. I had to do this work around you added after adding library.

WTF is wrong with React-Native?

@arun542

This comment has been minimized.

arun542 commented Jun 20, 2017

I tried all the solutions, but nothings work, i am using RN0.44, apps works fine on simulator as well as on phone with release config. But fails to archive.

@agrass

This comment has been minimized.

agrass commented Jun 22, 2017

@arun542 I was with same problem only when archiving and I solved adding React as target dependency on build phases settings of your project

@herarya

This comment has been minimized.

herarya commented Jun 23, 2017

@RajanPN thanks bro

@RajanPN

This comment has been minimized.

RajanPN commented Jun 23, 2017

@geekvijay @herarya Good to know that it worked!

@arun542

This comment has been minimized.

arun542 commented Jun 23, 2017

@agrass i tried that also did not work. In the end i had to recreate the project from scratch and i worked automatically. Something was screwed up in that project.

@andpor

This comment has been minimized.

andpor commented Jul 6, 2017

Same issue - app builds fine under Simulator but archiving is throwing all kinds of .h not being found from RN package...

Guys - this is the complete fix. I am able to archive the project just fine. The target section this fix refers to is under the scheme, Build screen.

Fix is here

On top of this I had to add header search paths in my project
$(SRCROOT)/../node_modules/react-native/React

What a mess!!!

Seems to be the same fix as RajanPN highlighted earlier :)

iancanderson added a commit to thoughtbot/PurpleTrainElm that referenced this issue Jul 26, 2017

Fix build archiving in XCode
See
facebook/react-native#12042 (comment)

- Adds React project as a target in our Release scheme
- De-parallelizes the build
@kyle-ssg

This comment has been minimized.

kyle-ssg commented Aug 5, 2017

I have a feeling a lot of people are getting into this situation by creating a new scheme when wanting to do a prod build. Instead of selecting new scheme from xcode make sure you duplicate your current scheme. Schemes are created with parallelization on by default, also you'd be missing vital things such as including the React build target.

Instead of creating a new scheme for production do the following:

Goto edit scheme > manage schemes > click the cog after selecting your local scheme and click duplicate scheme, you can then edit that and select build for release.

cadichris added a commit to cadichris/darts-cricket that referenced this issue Aug 18, 2017

App iOS qui build via XCode.
Avec ce commit, l'app build correctement via XCode.
Tout ce qui est "appreactnative" a maintenant disparu. Tout est renommé "alkeyacricket". À la fois sur android et iOS.

Problèmes rencontrés et les solutions :
Pb de build : facebook/react-native#12042 (comment)
@aamalik

This comment has been minimized.

aamalik commented Jan 18, 2018

Tried everything that is mentioned above but still does not work. I am using 0.52.
Its my second day with react-native and I am just gonna keep on hustling till I fix it.
Why are there so many problems with react-native?

@aamalik

This comment has been minimized.

aamalik commented Jan 18, 2018

#17027

The above issue is actually my issue. Somebody has submitted a pull request

@russelh15

This comment has been minimized.

russelh15 commented Jan 27, 2018

My issue was that I was building on a custom Schema, in my case, "Staging". I had to change the Per-Configuration Build Products Path and the Per-configuration Intermediate Build Files Path to use the "Release" paths instead of the "Staging" path.

If you're project contains Pods, you will need to adjust these values in the Pod project as well as change the PODS_CONFIGURATION_BUILD_DIR config for that custom schema so that it matches the Release schema

@WundrApp

This comment has been minimized.

WundrApp commented Feb 7, 2018

Hello Guys,

I just updated to RN52 from RN38, solved all of my RCT includes to have the <React/ prefix, and removing all references to react-native in third party modules and now I'm stuck with this issue.

I have a 'RCTBridge+Private.h' file not found when trying to build.

I tried updating to ^2.2.6, unlink and re-link but still not working.

Has anyone been facing he same issue ?

Thanks

@n1ru4l

This comment has been minimized.

n1ru4l commented Feb 20, 2018

@russelh15 Thank you so much! I do not know if this is the ideal solution, however having just spent a half day getting things working I am fine with this.

@DavitVosk

This comment has been minimized.

DavitVosk commented Feb 25, 2018

I tried deleting node-modules and installing packages back and it worked. Hope this will help someone else :)

@unicornRainbows

This comment has been minimized.

unicornRainbows commented Apr 8, 2018

React-native ...

@unicornRainbows

This comment has been minimized.

unicornRainbows commented Apr 8, 2018

I do <3 you but sometimes you make me feel crazy...

@robertobrogi

This comment has been minimized.

robertobrogi commented Apr 20, 2018

I have the same problem.... :( 'React/RCTBridge.h' file not found with expo kit 26 and react-native-beacons-manager

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.