question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'React/RCTUtils.h' file not found

See original GitHub issue

Bug

I get the following error when trying to build the iOS app.

.../node_modules/react-native-device-info/ios/RNDeviceInfo/RNDeviceInfo.m:13:9: fatal error: 'React/RCTUtils.h' file not found

Environment info

I use pods in my project.

React native info output:

    System:
      OS: macOS 10.14.5
      CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
      Memory: 54.81 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.7.0 - /usr/local/bin/node
      Yarn: yarn install v0.27.5
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.73s. - /usr/local/bin/yarn
      npm: 6.5.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 19, 22, 23, 24, 25, 26, 27, 28, 29
        Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.3, 28.0.2, 28.0.3
        System Images: android-19 | Intel x86 Atom, android-19 | Google APIs ARM EABI v7a, android-19 | Google APIs Intel x86 Atom, android-22 | Android TV Intel x86 Atom, android-22 | ARM EABI v7a, android-22 | G
oogle APIs Intel x86 Atom_64, android-23 | Android TV ARM EABI v7a, android-23 | ARM EABI v7a, android-23 | Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Intel x86 Atom, android-24 | Google
 APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-25 | Google APIs ARM EABI v7a, android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.1 => 16.6.1 
      react-native: 0.57.7 => 0.57.7 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Library version: 2.1.2

Steps To Reproduce

  1. Install and link: 1.1. npm install 1.2. react-native link react-native-device-info 1.3. pod install
  2. Run the project in Xcode.

Describe what you expected to happen:

The iOS project should successfully build and run.

Reproducible sample code

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'MyApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MyApp
  pod 'FBSDKCoreKit', '4.40'
  pod 'FBSDKLoginKit', '4.40'
  pod 'FBSDKShareKit', '4.40'
  pod 'GoogleSignIn', '~> 4.4.0'

  # Required for new version of react-native-device-info, see https://github.com/react-native-community/react-native-device-info#manual
  pod 'React', :path => '../node_modules/react-native'

  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'MyApp-tvOS' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MyApp-tvOS

  target 'MyApp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

# React-Native is not great about React double-including from the Podfile
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
    # It removes React & Yoga from the Pods project, as it is already included in the main project.
    targets_to_ignore = %w(React yoga)
    if targets_to_ignore.include? target.name
      target.remove_from_project
    end
  end
end

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:24

github_iconTop GitHub Comments

17reactions
JordanRosascommented, Jul 24, 2019

hey @alexstoyanov I had this same error. My mistake was using both pod install and react-native link <pakcageName> so I ran react-native unlink packageName. Then I went into the ios directory of my react native project and ran pod deintegrate && pod install then cd back to the root of the project and run react-native run-ios. everything is working great.

1reaction
nartccommented, Jun 21, 2019

Correct.

And in regards to your above comment, I agree and learned it the hard way. I blame it on my lack of knowledge.

I’ll try reverting to the point before I “re-linked” RNDeviceInfo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'React/RCTUtils.h' file not found - Stack Overflow
I found the same error in this thread. It said the error was caused by incorrect installation of plugins. If you use Pod...
Read more >
React Native - Manual iOS Setup - Flipper
Install the dependencies by running cd ios && pod install then continue to Initialization. React Native 0.62​. In version 0.62, the setup includes...
Read more >
'RCTLog.h' file not found & Us… | Apple Developer Forums
The technical issue is as follows: it seems to be appearing in the RNBranchConfig.m file within the react-native-branch package for iOS specifically in...
Read more >
react-native-blob-util - npm
A module provides upload, download, and files access API. Supports file stream read/write for process large files.. Latest version: 0.17.0, ...
Read more >
[Resolve]-'React/RCTUtils.h' file not found - appsloveworld
Compiling PdfManager.m ❌ /Users/runner/runners/2.166.3/work/1/s/node_modules/react-native-pdf/ios/RCTPdf/PdfManager.m:16:9: 'React/RCTUtils.h' file not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found