In my react-native project (react-native#0.60) in the ios/ dir I run pod install and get this error:
[!] Invalid `Podfile` file: no implicit conversion of nil into String.
# from /Users/coryrobinson/projects/hhs2/ios/Podfile:37
# -------------------------------------------
#
> use_native_modules!
# end
# -------------------------------------------
I haven't added or changed anything in this Podfile - it's all react-native generated. (I'm not experienced in iOS dev so this might be a simple fix, I just don't know what to look for :-|) Thanks for any help!
Here is my Podfile
platform :ios, '9.0'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
target 'hhs2' do
# Pods for hhs2
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-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
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 'RNFS', :path => '../node_modules/react-native-fs'
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'
target 'hhs2Tests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'hhs2-tvOS' do
# Pods for hhs2-tvOS
target 'hhs2-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Here is the correct answer:
1 - Your POD File should contain this line on top
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
2 - Make sure your package.json and node_module folders has this module installed
cli-platform-ios/native_modules
3 - If you didn't find after you run yarn install - means you have old cache node_modules in your machine and you need to clean it before reinstalling the package again.
4 - Clean cache yarn cache clean
5 - Make sure you have this file react-native.config.js and its configuration is VALID - and it doesn't have non-existing NPM packages - this step is LAST AND MOSTLY THE CAUSE of the error
Example of my react-native.config.js
module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./assets/fonts/'],
dependencies: {}, // make sure this dependencies are all valid installed packages or empty if you don't need it
};
6 - Install node packages yarn install and your pods should work now! pod install --repo-update
HAPPY coding!
Downgraded #react-native-community/cli-platform-ios from 3.1.0 to 3.0.0 and it worked.
Added
"#react-native-community/cli-platform-ios": "3.0.0"
to package.json.
Run npm install and then pod install to get it working again.
If you are using
pod install --project-directory=ios
you might need to tweak the Podfile by replacing
use_native_modules!
to
use_native_modules!(".")
Maybe this behavior will be improved in the future, I opened an issue about it https://github.com/react-native-community/cli/issues/657
this is because the outdate yarn version on your device,
if you on macOS you can upgrade/install the yarn with follow this link:
here it is
be aware to delete node-module and yarn.lock file, install all packages again, navigate to ios folder and run pod install.
Verify if you have #react-native-community/cli-platform-ios in your package.json,
if you dont run:
npm install #react-native-community/cli-platform-ios
then
cd ios && pod install
i just dropped the whole node_modules and RN cache folder and did a clean reinstall, this fixed the "use_native_modules" problem so far....but after that i had to hassle a lot with other libs which where just not RN0.60 ready ;)
For me, I deleted the node_modules and installed again by using npm install . After that, I navigated to /ios folder and ran pod install it worked.
Ok, my guess is for most people, the accepted answer will fix their issue. For me, the fix was so bizarre, I had to add it here.
For whatever reason, I ended up creating an invalid AndroidManifest.xml file in my android native setup.
I looked at the full error output, and the first lines of the error referenced a line number and column number. At that point in my xml file I broke the xml formatting.
2 days of searching to find a GitHub Issue with a description of where to look.
Don't use yarn install. Thats what worked for me...
Go to main folder
Delete nodes folder
Run sudo npm install or just npm install
cd ios
pod install
Having same issue while building app on AppCenter, locally works perfectly
Is there any possibility to track this error? Cause I've seen that there can be a lof of reasons why I see it.
Steps to follow :
npm install
npm install -g react-native-cli
go to your ios folder -> cd ios
pod install
Easily:
Run sudo xcode-select --switch /Applications/Xcode.app in the root of your React Native project.
In the ios folder run pod install.
Edit:
No hacks with any of:
#react-native-community/cli-platform-ios
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
were needed.
After removing several react-native npm packages (ie: react-native-bluetooth-serial, react-native-sound, and more...) pod install works.
It appears the pod install error is related to older react-native packages that don't support cocoa pods? I'm not sure the details but removing those packages from node_modules & package.json solved my issue.
The issue is that:
use_native_modules!
is unsupported by earlier versions of CocoaPods. For example, our install was the app downloaded from the CocaoPods website. That version is 1.5.2.
Run:
pod --version
to check which version. If need be, uninstall and then re-install but in Terminal by running:
sudo gem install cocoapods
At least as of late October 2019, the current gem version available is 1.8.4. Once successfully installed, re-attempt the pod install and hopefully all is well.
I got this error after I tried to react-native run-ios an Expo app. The error I got indicated that something was wrong with the Pods, so I ran cd ios && pod install, which is how I got a similar error as the OP.
In that case, you obviously need to expo start instead of react-native run-ios.
This started happening out of the blue today, and the problem was a space in my directory structure. Ex:
/path/to/Directory\ Name/RNProject throws the !native_modules error
/path/to/DirectoryName/RNProject works as it should
Pods was looking for "Directory. "
maybe its related to rights issues
adding "#react-native-community/cli-platform-ios": "3.0.0" in package.json
and
sudo chown -R user .
worked for me
In my case I had to switch to a newer version of node.
One of the reasons may be outdated version of Ruby. Use following command to upgrade it.
rvm install 2.6.1
rvm use 2.6.1 --default
Or you can follow below article, which has a detailed explanation of upgrading ruby and associated gems.
https://help.learn.co/en/articles/2789231-how-to-upgrade-from-ruby-2-3-to-2-6
Does anyone have a consistently recreatable solution for this issue that does not revolve around getting rid of use_native_modules? I have looked into:
Changing Ruby Version
Changing CocoaPods version
Invalidating NPM and Cocoapods cache
And I am unable to fix the issue. It appears to be some npm dependency, but others on my team are not seeing it.
Getting rid of the line use_native_modules! works as well. Maybe this has been deprecated or syntax has changed? Curious to hear from others.
Update: Seems to be an issue with react-native 0.60.0. Until a release fixes this bug, 0.59.10 can be explicitly installed, and you only need to add CocoaPods as necessary.
react-native init APP_NAME --version react-native#0.59.10
Go to this repository :ProjectName -> ios -> Podfile
In the Podfile, delete use_native_modules!
Execute again pod install
Enjoy your new pod
I was working on a react native project with the local database. I used this https://github.com/andpor/react-native-sqlite-storage for local database access. It was working fine with RN 0.41.
But now when I upgrade my RN version to 0.44 I am getting following errors with pod install.
Unable to satisfy the following requirements:
- `Yoga (= 0.44.0.React)` required by `React/Core (0.44.0)`
None of your spec sources contain a spec satisfying the dependency: `Yoga (= 0.44.0.React)`.
You have either:
* out-of-date source repos which you can update with `pod repo update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
This is my podfile:
target 'ProjectName' do
pod 'React', :path => '../node_modules/react-native' <br>
pod 'react-native-sqlite-storage', :path => '../node_modules/react-native-sqlite-storage'
end
I have tried lots of things but not able to solve this error. I created a new react project but and it was not working in that too
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
I am unable to find podSpec for any pod listed in my Podfile. My Podfile looks like this:
use_frameworks!
target 'MyTargetName' do
pod 'Gloss'
pod 'IQKeyboardManagerSwift'
pod 'ICViewPager'
pod 'SkyFloatingLabelTextField'
pod "KCFloatingActionButton"
pod "TSMessages"
end
Initially I got an error:
[!] Unable to find a specification for `IQKeyboardManagerSwift`
I've tried removing IQKeyboardManagerSwift, but then I get another error:
[!] Unable to find a specification for `ICViewPager`
I've checked both of those projects, and they exist on cocoapods.org, and podspec exists on github as well as the pod repo.
Everything started when I updated to Xcode 8.0 and Swift 3.0. Any idea what has gone wrong here?
EDIT:
I managed ti find a workaround that fixed issue related to downloading cocoapods:
use_frameworks!
target 'MyTargetName' do
pod 'Gloss'
pod 'IQKeyboardManagerSwift', :git => 'https://github.com/hackiftekhar/IQKeyboardManager'
pod 'ICViewPager', :git => 'https://github.com/iltercengiz/ICViewPager'
pod 'SkyFloatingLabelTextField’, :git => 'https://github.com/Skyscanner/SkyFloatingLabelTextField'
pod "KCFloatingActionButton”, :git => 'https://github.com/kciter/KCFloatingActionButton'
pod "TSMessages”, :git => 'https://github.com/KrauseFx/TSMessages'
end
Do you have the source at the top of your Podfile?
source 'https://github.com/CocoaPods/Specs.git'
Do these:
$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ rm -fr ~/.cocoapods/repos/master/
$ sudo rm -fr Pods/
$ sudo gem install cocoapods
$ pod setup
Then run $ pod install .. Hopefully It works
I'm trying to install Firebase via CocoaPods for my Objective-C iOS Application. My Podfile is as follows:
target 'RandomName' do
pod 'Firebase/Core'
pod 'Firebase/AdMob'
end
When I run pod install, I get the following error:
[!] Unable to satisfy the following requirements:
- `Firebase/Core` required by `Podfile`
None of your spec sources contain a spec satisfying the dependency: `Firebase/Core`.
You have either:
* out-of-date source repos which you can update with `pod repo update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
The latest version of CocoaPods is installed, and I have tried running pod repo update. Having a Podfile of the following works fine, but when I try to #import Firebase; in my AppDelegate.m file, Xcode cannot find the module.
target 'RandomName' do
pod 'Firebase'
end
However, the following combination does not install:
target 'RandomName' do
pod 'Firebase'
pod 'Firebase/AdMob'
end
Any help would be appreciated!
Check what version of Firebase is installed when you use pod 'Firebase'. For me it installs 2.4.3 which is an old version. The docs say that the pod should install 3.2 using that pod. It explains why the other pods don't work as they are part of Firebase 3. Pod update doesn't update Firebase to the latest version either. Even forcing a version doesn't work. It can't seem to find the new Firebase versions even though they are in the same podspec.
Here is how I solved it:
make sure you have the latest version of git installed
make sure you have cocoapods >= 1.0.0 installed
delete your pods repo (run pod repo remove master) and use pod setup to make a new one
use the following in your pod file
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Core'
(use whatever you want, just don't use 'Firebase')
pod install
everything should install properly
Running 'pod repo remove master' to remove the Pods repo //removes the library
Running 'pod setup' //clones the updated git repo for specs which takes long time as its size is beyond 300K (Be patient!)
Running 'pod install' //problem is solved
have you tried to add
frameworks
use_frameworks!
after target 'RandomName' line
and adding
platform :ios, '9.0'
before target ....
A couple of items to try. From your question, you did try the first two items, but leaving here for completeness of my answer.
The error response you get is helpful. Follow the steps for pod repo update
Make sure your pod is up to date.
pwd> pod --version
1.0.0
Make certain that your git is up to date. I had a build machine that had an outdated git (1.7), and I had the same exact error
-
When I updated to this version from git 1.7 it worked fine.
pwd> git --version
git version 2.8.1
My Podfile for using Firebase Dynamic Links
run pod init from the folder where your .xcodeproj is
Be sure to only launch the .xcworkspace instead of the .xcodeproj from here out.
platform :ios, '8.0'
use_frameworks!
target 'the-name-of-target' do
pod 'Firebase/DynamicLinks'
end
The Same problem occurred while on pod install command.
Please relaunch terminal and navigate to your Xcode project then
simply fire same pod install command. 'Firebase/Database' will installed successfully :)
I just doing following step to fix this error:
$pod setup -- verbose
Then do $pod install
that works for me and my pod file is:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'the-name-of-target' do
pod 'Eureka', '~> 1.6'
end
UPDATE:
Then you can remove your master and re-install cocoapods using following code:
cd ~/.cocoapods/repos
rm -rf master
pod setup
I had the same error, and my solution was to downgrade Cocoapods to 1.0.0, because Cocoapods 1.0.1 didn't work as I expected. Everything works great now!
sudo gem uninstall cocoapods -v 1.0.1
sudo gem install cocoapods -v 1.0.0
My Podfile:
platform :ios, '8.0'
target 'XXX' do
pod 'Firebase/Auth'
pod 'Firebase/Database'
end
For people still having problems with this. When directly coping the firebase walkthourgh website, the install string is:
pod `Firebase/Core`
While it should have been:
pod 'Firebase/Core'
No need for pod setup if this applies to you too.
Update Git and Cocoapods to the last version:
Git: $ brew update && brew upgrade
Cocoapods: $ pod repo update