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
Related
I've taken several steps to resolve this issue, including deleting node_modules, deleting pod.lock, ran yarn cache clean, ran npx react-native-clean-project, ran pod install --repo-update ... but nothing so far has worked. This is for an Expo bare workflow project.
[!] CocoaPods could not find compatible versions for pod "ReactCommon/callinvoker":
In Podfile:
ReactCommon/callinvoker (from `../node_modules/react-native/ReactCommon`)
None of your spec sources contain a spec satisfying the dependency: `ReactCommon/callinvoker (from `../node_modules/react-native/ReactCommon`)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
open podfile in ios folder
and replace
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
to
pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
I downgraded from react-native 0.63.3 to react-native 0.62.2, and that solved my cocoa pods issue.
To downgrade react-native use either of the following commands depending on your package manager.
npm install react-native#x.x.x or yarn add react-native#x.x.x
For more information on how to downgrade react-native check out the link below and hopefully it helps!
Proper mechanism to downgrade react-native
open podfile in ios folder
and replace
pod 'React-callinvoker', :path => "#{rnPrefix}/ReactCommon"
to
pod 'React-callinvoker', :path => "#{rnPrefix}/ReactCommon/callinvoker"
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'
Recently upgraded to XCode 8.1 trying to install Alamofire pod for a new project. Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'app' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for app
pod 'Alamofire',
:git => 'https://github.com/Alamofire/Alamofire.git',
:branch => 'swift3'
end
And my terminal responds:
image
so what can I do?
--Update--
also tried pod 'Alamofire', '~> 4.0'
here is the result
I did the pod repo update it doesn't do anything at all
Edit your podFile as below and just install the pods using pod install --verbose command if still error exists then update your repo with pod repo update then try again.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'app' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for app
pod 'Alamofire'
end
As per the discussion here,
You need to use
pod 'Alamofire', '~> 4.0'
In your pod file
I faced the same problem when i updated the mac os from el capitan to sierra and installed new version of Xcode.
I updated the cocoapod and still, was facing the same problem.
I found a solution by completely removing cocoapod from root directory and installing it again.
To remove the cocoapod completly use this in terminal
$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/
and then install the cocoapod again
$ gem install cocoapods
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 am trying to install Cocoapods, and it kind of hang while downloading AlamoFire!
Anyone have faced similar issue?
1) Open terminal
2) sudo gem install cocoapods
sudo gem install -n /usr/local/bin cocoapods
3) pod setup
4) create a xcode project
5) cd "path to your project root directory"
6) pod init
7) open -a Xcode Podfile
8) pod 'Alamofire', '~> 3.4'
It just feel like hanged and not sucessfull even after long wait!
Thanks in Advance!!!
Use this one in your pod file ->
**source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'Pod DemoTests' do
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire'
end**
this will solve your problem ..
pod Installation
1.sudo gem install cocoapods
2.pod init
3.import needed framework in podfile
4.pod install
5.open with workspace.