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

No such module 'React' #26256

Closed
tiagobbraga opened this issue Aug 29, 2019 · 12 comments
Closed

No such module 'React' #26256

tiagobbraga opened this issue Aug 29, 2019 · 12 comments
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@tiagobbraga
Copy link

tiagobbraga commented Aug 29, 2019

No such module 'React' in the new project!

My old project with react native not run with react native 0.60.5.

I create a new iOS project and integrate with React Native (https://facebook.github.io/react-native/docs/integration-with-existing-apps), but the result is the same, I can't run the project because the module React no such.

React Native version:

System:
OS: macOS 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 57.05 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.6.0 - ~/.nvm/versions/node/v10.6.0/bin/node
Yarn: 1.5.1 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.6.0/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.2, 26.0.3, 27.0.3, 28.0.3, 29.0.0
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react-native: ^0.60.5 => 0.60.5

My package.json:

{ "name": "MyReactNativeApp", "version": "0.0.1", "private": true, "scripts": { "start": "yarn react-native start" }, "dependencies": { "react-native": "^0.60.5" } }

My Podfile:

`platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'NewReactNativeIntegrate' do
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

use_native_modules!
end
`

@owinter86
Copy link

owinter86 commented Aug 29, 2019

I had the same issue, seems like the imports are now case sensitive.

changing import react from 'React' to import react from 'react' fixed the issue for me.

@tiagobbraga
Copy link
Author

tiagobbraga commented Aug 29, 2019

Hi..

So, the problem is in Xcode with Swift, see:

Screen Shot 2019-08-29 at 3 30 26 PM

@iShawnWang
Copy link

same issue here

@baicuhaha
Copy link

the same problem Xocde 10 RN 0.60.5, react can't be found

@xutopia
Copy link

xutopia commented Sep 17, 2019

Hi, I'm running into the same No such module 'React' error.
In the past our project has always had use_frameworks! enabled, but React-Native 0.60.5 documentation says to remove use_frameworks!, which I speculate is the reason we're seeing the No such module 'React' error.

Here is issue #25349 where others indicate the need for use_frameworks!, and some workarounds that may work for you (your mileage may vary).

The other option is to use React-Native@0.61.0-rc.3, which has use_frameworks! support.

@xutopia
Copy link

xutopia commented Sep 17, 2019

I managed to resolve the No such module 'React' error and successfully build iOS app. My steps:

  1. Upgrade my React-Native dependency from RN 0.60.5 to RN 0.61.0-rc.3 via React Native Upgrade Helper
  2. Add the line use_frameworks! to your Podfile, under target '<your target name>' do
  3. Perform fresh install of your Pods ($ pod install)
  4. In Xcode, clean your project and delete Derived Data
  5. Build/Run your app

Please note that RN 0.61 is still a release candidate and not yet stable at the time of this post. Use with caution.

@Marcus172
Copy link

Hi, I was experiencing same issue in my project and have finally fixed it by turning ONLY_ACTIVE_ARCH = 'NO' in Build Config tab on Pods project in XCode on RN 0.61.2 version.

I added post_install hook to Podfile:

post_install do |installer_representation|
  installer_representation.pods_project.build_configurations.each do |config|
    config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
  end

  installer_representation.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
    end
  end
end

Hopefully this will help.

@ivoilic
Copy link

ivoilic commented Feb 15, 2020

Having the same issue. When I try @xutopia 's solution I have issues with the test framework file disappearing.

@xutopia
Copy link

xutopia commented Feb 15, 2020

@ivoilic, I'm assuming your test framework file is somehow tied with your pods. Hence why the file is disappearing when you perform fresh pods install?
Maybe try manually adding the test framework file back into your project after fresh pod install?

@itvignes09
Copy link

I am facing the same issue. Any solution?

@stale
Copy link

stale bot commented May 20, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label May 20, 2020
@stale
Copy link

stale bot commented May 30, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed May 30, 2020
@facebook facebook locked as resolved and limited conversation to collaborators May 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

8 participants