Unable to resolve Module 'React' after upgrading to 0.61.4
See original GitHub issueI am getting this issue after upgrading to 0.61.4 in ios
Unable to resolve module React
from ios/Pods/React/Libraries/react-native/react-native.js
: React could not be found within the project or in these directories:
node_modules
I tried npm start – – reset-cache, clearing derived data. clean project etc.
tried replacing
var ReactNative = Object.assign(Object.create(require('React')), {
with
var ReactNative = Object.assign(Object.create(require('react')), {
in /ios/Pods/React/Libraries/react-native/react-native.js
But the issue exists in the file react-native.js
React Native version: System: OS: macOS Mojave 10.14.4 CPU: (4) x64 Intel® Core™ i5-5257U CPU @ 2.70GHz Memory: 172.62 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.0 - /usr/local/bin/node Yarn: 1.19.1 - /usr/local/bin/yarn npm: 6.11.3 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 IDEs: Xcode: 11.2/11B52 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: ^0.61.4 => 0.61.4 npmGlobalPackages: react-native-cli: 2.0.1
Steps To Reproduce
- Run project from Xcode
- The app starts with this red screen with error
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
@krishnadas89 I’ve got the same error.
Steps I’ve done:
rm -rf ios/Pods
rm -rf node_modules
pod 'React', :path => '../node_modules/react-native'
topod 'React', :path => '../node_modules/react-native/'
inPodfile
.npm cache clean --force
npm install
npm install redux
cd ios && pod install
Xcode
Xcode
And it worked. 👍
Oh, I see it now. Metro tries to resolve
ios/Pods/React/Libraries/react-native/react-native.js
but there shouldn’t beReact
pod in your pods, it should be taken from node_modules.Remove
ios/Pods
and runpod install
again. Also make sure your Podfile is valid and looks like this one: https://github.com/facebook/react-native/blob/0.61-stable/template/ios/Podfile