Skip to content
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
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Phenek
Copy link

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
Copy link

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
Copy link

same issue here

@Phenek
Copy link
Author

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
Copy link

ghost commented Jan 24, 2017

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

@Phenek
Copy link
Author

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
Copy link

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
Copy link

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
Copy link

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
Copy link
Author

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
Copy link

@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
Copy link
Author

Phenek commented Jan 25, 2017

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

@Phenek Phenek closed this as completed Jan 25, 2017
@OpakAlex
Copy link

@Clovs thanks you man!

@Phenek
Copy link
Author

Phenek commented Jan 25, 2017

не за что )))

@OpakAlex
Copy link

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

@Phenek
Copy link
Author

Phenek commented Jan 25, 2017

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

@OpakAlex
Copy link

;)

@rpylipow
Copy link

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
Copy link

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

#12077

@Phenek Phenek reopened this Jan 26, 2017
@robhogan
Copy link
Contributor

@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
Copy link

@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
Copy link
Author

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 as completed Feb 1, 2017
@Msspl-PrashenjeetRoy
Copy link

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
Copy link

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
Copy link

@RajanPN You saved my day :)

@onpaws
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

herarya commented Jun 23, 2017

@RajanPN thanks bro

@RajanPN
Copy link

RajanPN commented Jun 23, 2017

@geekvijay @herarya Good to know that it worked!

@arun542
Copy link

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
Copy link

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 :)

@kyle-ssg
Copy link

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/cool-darts that referenced this issue Aug 18, 2017
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)
@yar-malik
Copy link

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?

@yar-malik
Copy link

#17027

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

@russelh15
Copy link

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
Copy link

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
Copy link
Contributor

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
Copy link

DavitVosk commented Feb 25, 2018

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

@unicornRainbows
Copy link

React-native ...

@unicornRainbows
Copy link

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

@robertobrogi
Copy link

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
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests