Could not find the following native modules after upgrading the react-native to latest version 0.61.4 - react-native

After upgrading the react-native version I am getting the following. And failed to run the build in simulator
After this, I have run react-native run-ios it shows all my packages are manually linked and you need to unlink all packages.
Also, can anyone clarify the react-native-config.js file is mandatory for this after updating to the latest react-native.
Always I open the app.Xcodeproj but the below shows I need to open app.xcworkspace. Can anyone clarify this?
warn The following packages use deprecated "rnpm" config that will stop working from next release:
- react-native-fetch-blob: https://github.com/wkh237/react-native-fetch-blob#readme
- react-native-orientation: https://github.com/yamill/react-native-orientation#readme
- rn-fetch-blob: https://github.com/joltup/rn-fetch-blob#readme
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
error Could not find the following native modules: BugsnagReactNative, react-native-camera, react-native-cookies, react-native-fast-image, react-native-fetch-blob, RNFS, RNGestureHandler, RNImageCropPicker, react-native-image-picker, RNImageRotate, BVLinearGradient, react-native-orientation, RNShare, RNSVG, RNVectorIcons, RNViewShot, react-native-webview, rn-fetch-blob. Did you forget to run "pod install" ?
info Found Xcode workspace "Fashion.xcworkspace"

This should fix your issue.
rm -rf ios/Pods && rm -rf ios/build && cd ios && pod install && cd ../
rm -rf node_modules && rm yarn.lock && yarn install
PS: In react-native version 0.60 and above, native modules are now auto-linked. See the docs for more: https://facebook.github.io/react-native/blog/2019/07/03/version-60#native-modules-are-now-autolinked

firstly, when you update the react-native version, you should react-native official document. to avoid some wrong things. the details for update in the react-native update helper.
and for your question, since 0.60, CocoaPods are now part of React Native's iOS project. If you weren't already, be sure to open iOS platform code using the xcworkspace file from now on.
At the same time, a react-native link is now not needed in most situations anymore. the react-native team overhauled the linking process in general. Be sure to react-native unlink any preexisting dependencies as mentioned in the docs above.for more details, you can read this article.
for the rnpm problem, firstly you should delete it in the package.json.
then create a react-native.config.js file in project folder.
const ios = require('#react-native-community/cli-platform-ios');
const android = require('#react-native-community/cli-platform-android');
module.exports = {
project: {
ios: {},
android: {},
},
// assets: ['Resources/fonts'], // stays the same
// commands: require('./path-to-commands.js'),
};
then in the rn-fetch-blob(make is as an example), you also create
react-native.config.js and modify it according to its rnpm config

In the latest react-native stable version, you dont need to link the 3rd party libraries, just install it and it will work fine
Firstly,
So, when you are migrating from lower version to higher stable version,
then what you need to do, just unlink all the libraries you have used
in your project as react-native automatically detects its
dependencies. and moreover remember that whenever you install such
libaries you don't need to run the react-native link <library-name>
to link it.
Secondly,
Now you need to work with xcworkspace file as in the latest version,
ios are dealing with pods, and when pods comes into picture then you
have to use xcworkspace instead of Xcodeproj in your ios project
You can check the changelog here for react native 0.61.4 version.
I hope this helps....Thanks :)

My solution is to combine some tips above and update mine Pod file
Simply reset:
rm -rf ios/Pods && rm -rf ios/build
cd ios && pod install && cd ..
rm -rf node_modules && rm yarn.lock && yarn install
Reason is to maximize future compatibility.
Here is a facebook provided template, pick some goodies for your existing old pod file:
https://github.com/facebook/react-native/blob/0.63-stable/template/ios/Podfile
You may found code below is auto linking,
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
You may need to upgrade ios target
platform :ios, '10.0'
You may use Flipper without use_frameworks! enabled

Could be that there is something in your podfile that causes this. For example, I removed a library from my project but there was still a reference to it in the podfile:
pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
Once commenting/removing this line, pod install works great.

For me just converting npm install to yarn install worked because other team was using yarn and i was trying to install packages using npm so it created some conflict.
I recloned the project then
'yarn install', 'react-native link' and then
'pod install'

Related

Build command failed after running existing project on mac using npx react-native run-ios command

I tried to run an existing react-native project on mac to create ios build but i've been getting into an unusual error as mentioned below. I don't know what RCT-Folly does as i am new to react-native but i think the error is related to RCT-Folly, I tried many other stack answers but couldn't solve it
Here is a picture of the error
I have tried the other solution like creating a fresh projects and copying files, also tried reinstalling cocoapods,
If there is some other thread that you guys think i should try please let me know
Stuck at this for more than 3 days now!
Update:
After downgrading react native version it is now showing this error:
CompileC /Users/admin/Desktop/MTM/mindToMindfull\ 2/ios/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/RCTJSThread.o /Users/admin/Desktop/MTM/mindToMindfull\ 2/node_modules/react-native/React/Base/RCTJSThread.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-Core' from project 'Pods')
RCT-Folly is an iOS Cocoapod library. Try cleaning your project first. From the project root, run (for Yarn)
watchman watch-del-all && rm -f yarn.lock; rm -rf node_modules,
then
yarn
cd ios && rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData/; rm Podfile.lock; pod deintegrate; pod setup; pod install && cd ..
yarn ios
I haven't used npm in awhile. But for 2 and 4, use npm install and npx react-native run-ios
Solved by downgrading react-native version 0.66.4
then installing pods and build was a success.

How to run pod file in iOS directory in react native?

error Could not find "Podfile.lock" at projects\reactNative\ios\Podfile.lock. Did you run "pod install" in iOS directory?
(node:11696) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
error Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues. Run CLI with --verbose flag
Issue 1
For fixing the issue:
Could not find "Podfile.lock" at projects\reactNative\ios\Podfile.lock. Did you run "pod install" in iOS directory?
Please make sure you have install cocoapods and run this command at your project root:
gem install cocoapods // If you haven't install cocoapods
cd ios && pod install && cd ..
Issue 2
For fixing the issue:
(node:11696) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use node --trace-warnings ... to show where the warning was created)
Please downgrade your node.js version to v13.x.x, one of the solutions below:
npm install -g n
sudo n 13.13.0
Issue 3
For fixing the issue:
Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues. Run CLI with --verbose flag
Please make sure you have installed Xcode correctly from App Store and use the latest React Native version in your project (should be v0.62.2 now for stable). If still cannot open the project, please try to add some simulator in Xcode's developer settings.
Cheers!
you did not install cocoapods
install cocoapods commands
sudo gem install cocoapods
after that in react native directory
cd ios && pod install && cd ../ && react-native run-ios
CocoaPods manages library dependencies for your Xcode projects. We need it to setup the iOS project. Like yarn
sudo gem install cocoapods
The Podfile is a specification that describes the dependencies of the targets of one or more Xcode projects. Like package.json
access to the folder with Podfile, run
pod install
This will resolve the code of those dependency framework, and generate Pods.xcodeproj for your iOS project.

how do I delete library clearly in react native?

I want to delete react-native-google-signin library.
so I remove it using 'yarn remove react-native-google-signin'
But when I bulid my app, it seems to be there.
How can I solve this error?
In your scenario, after removing library or package you need to do pod install after that for iOS..
SOLUTION
if you are using yarn
yarn remove react-native-google-signin
If you are using npm
npm uninstall --save react-native-google-signin
After that move into your ios folder using cd ios
Then run pod install using pod install
Finally, close existing workspace from XCODE and reopen and before run your project clean your project ( Command+Shift+K ) and run

Autolinking dependencies in React Native

Context
I have a couple of React Native apps which share some components and helpers.
So I created a library to store the shared code, and I use it in my apps by adding it as a dependency in the respective package.json.
Inside my custom library, I use react-native.config.js to link some fonts
module.exports = {
assets: ['./assets/fonts']
};
And in my apps, I do npx react-native link my-custom-library to link these fonts.
Now, this shared library is also using react-native-community/react-native-localize.
And I don't know how to link it in my apps 🤔
I have 2 questions here:
Why do I need to do npx react-native link my-custom-library for the fonts?
Shouldn't React Native 60's autolinking feature do this for me automatically?
How can link react-native-localize using this setup?
1) About the fonts for RN 0.60+:
you should have a react-native.config.js
with a content like this:
module.exports = {
project: {
ios: {},
android: {},
assets: ['./src/assets/fonts', 'react-native-vector-icons'],
// Add the rn-vector icons in the above array only if you use that module, or your <libraryName> too.
};
Run react-native link and you should see a log like this:
info Linking assets to ios project info Linking assets to android
project success Assets have been successfully linked to your project
Add the fonts in Info.plist file:
<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Octicons.ttf</string>
<string>Zocial.ttf</string>
</array>
Check Run Script Only When Installing in Xcode->YourProjectTarget->BuildPhases-> Copy Pods Resources
Make sure you clean all the cache:
rm -rf $TMPDIR/react- && rm -rf $TMPDIR/metro- && rm -rf $TMPDIR/haste-* && watchman watch-del-all && rm -rf ios/build and restart JS server.
Source and more info here:
https://medium.com/#mehran.khan/ultimate-guide-to-use-custom-fonts-in-react-native-77fcdf859cf4
I couldn't make the fonts work without the react-native link command and it seems that other people encountered this issue too.
2) About the react-native-localize
If you already linked it manually just run react-native unlink react-native-localize and then go to ios folder and run a pod install.
The line use_native_modules (from Podfile) will make the pod installer search for a pod spec file (RNLocalize.podspec) in the library folder from node_modules and install it and link it automatically.
Notes:
This answer has been tested in RN 0.61.4 on iOS simulator
Hints how to link a library that provides fonts I found here:
https://github.com/oblador/react-native-vector-icons/issues/1041

How to fix 'boost/operators.hpp' file not found' error in react-native

when I use 'react-native run-ios', there is some error, 'boost/operators.hpp' file not found.
I can not build and run my project:
react-native-cli: 2.0.1
react-native: 0.59.9
npm: 6.9.0
yarn: 1.16.0
node: v12.4.0
os: macos 10.14.5
xcode: 10.2.1
▸ Compiling JSIDynamic.cpp
❌ /Users/lidongbo/WorkBentch/ReactNative/AwesomeProject/node_modules/react-native/React/../third-party/folly-2018.10.22.00/folly/dynamic.h:63:10: 'boost/operators.hpp' file not found
#include <boost/operators.hpp>
^
▸ Analyzing JSCRuntime.cpp
▸ Analyzing jsi.cpp
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AwesomeProject.xcodeproj
project can build and run.
If you get this issue in react-native-reanimated after upgrading to react-native 0.66 update your react-native-reanimated in package.json
Try "react-native-reanimated": "2.3.0-beta.2"
Don't forget to run yarn install or npm install to update your packages. Also do a pod install for ios and restart your server instance .
EDIT:
Support for react-native#0.66 has been officially added by react-native-reanimated#2.2.3 It is less buggy and a lot more issues have been solved.
Also check issue on github.
This might due to incomplete pods install - try deleting ios/Pods folder and run pod install under ios.
An alternative error for the same issue that I encountered was:
ios/Pods/boost-for-react-native/boost/operators.hpp:97:10: 'boost/config.hpp' file not found
To fix it, you need to clear cocoa pods and cache and re-install.
Delete cocoa pods cache: rm -r ~/Library/Caches/CocoaPods
Delete the Pods folder and the Podfile.lock usually located in <project_root>/ios.
Reinstall pods: pod update
You must delete cache from wherever ios concerns; Here's the process I do to clear its cache:
Delete npm cache: npm cache clean --force
Delete All ios temp files: cd ios && rm -r Pods/ Podfile.lock {yourProject}.xcworkspace
Clear Cocoapods Cache: rm -r ~/Library/Caches/CocoaPods
now install pods via npx: cd .. && npx pod-install
So I was also getting the error boost/operators.hpp file not found but my issue was from using :path instead of :podspec in my Podfile. I'm working on an integrated RN app inside of a Native iOS app, so I was manually adding the pods to the Podfile (something I will not do from now on).
pod 'boost', :path => ...
instead of
pod 'boost', :podspec => ...
It might not be the most common fix but hoping it helps someone.
I resolve the problem.
boost_1_63_0.tar.gz
double-conversion-1.1.6.tar.gz
folly-2018.10.22.00.tar.gz
glog-0.3.5.tar.gz
These files are not completely downloaded due to network reasons.
The file url is :
{your proejct}/node_modules/react-native/scripts/ios-install-third-party.sh at lowest line.
When I upgraded RN 0.64 -> 0.66, the following helped me:
Delete cocoa pods cache: rm -r ~/Library/Caches/CocoaPods
Delete the Pods folder and the Podfile.lock usually located in <project_root>/ios
Delete Pod folder in <project_root>/ios
yarn add react-native-reanimated#2.2.3
pod install