I'm not sure if this is an issue in react-native or CocoaPods, but I am unable to install pods because of it.
The error I'm getting happens when I run pod install in my ios folder.
CocoaPods : 1.9.3
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
RubyGems : 3.1.2
Host : macOS 10.16 (20A4300b)
Xcode : 11.5 (11E608c)
Git : git version 2.17.1
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.2.0
require_relative '../../node_modules/react-native/scripts/react_native_pods'
require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target '<proj>' do
rn_maps_path = '../../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
^^^^^^^^^^^^^^^^^
I think that this is the source of the error
target '<proj>Tests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target '<proj>-tvOS' do
# Pods for <proj>-tvOS
target '<proj>-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Errno::ENOENT - No such file or directory @ rb_sysopen - /<me>/rn-web/native/node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open-uri.rb:37:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open-uri.rb:37:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open-uri.rb:37:in `open'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/external_sources/podspec_source.rb:19:in `block in fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:86:in `titled_section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/external_sources/podspec_source.rb:11:in `fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:980:in `fetch_external_source'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:959:in `block (2 levels) in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:958:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:958:in `block in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:957:in `fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:117:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
I would expect "reactNativePath" to return "reactNativePath": "/<me>/rn-web/node_modules/react-native", which it does (in both yarn react-native config and yarn workspace native react-native config) but the Podfile is still searching relative to native/.
In fact, /<me>/rn-web/node_modules/react-native/third-party-podspecs/DoubleConversion.podspec (without the native) exists and appears to be the correct file. CocoaPods is simply not finding it correctly.
➜ yarn react-native info
yarn run v1.22.4
warning package.json: No license field
$ /<me>/rn-web/node_modules/.bin/react-native info
info Fetching system and libraries information...
System:
OS: macOS 10.16
CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
Memory: 203.96 MB / 16.00 GB
Shell: 5.8 - /usr/local/bin/zsh
Binaries:
Node: 14.4.0 - /var/folders/p0/zs4d5cks66vflrdz92_3_b6w0000gn/T/yarn--1594767815780-0.17405630440758024/node
Yarn: 1.22.4 - /var/folders/p0/zs4d5cks66vflrdz92_3_b6w0000gn/T/yarn--1594767815780-0.17405630440758024/yarn
npm: 6.14.6 - ~/.nvm/versions/node/v14.4.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
Languages:
Java: 13.0.2 - /usr/bin/javac
Python: 2.7.15 - /usr/local/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
npmGlobalPackages:
*react-native*: Not Found
✨ Done in 3.25s.
I expect pod install to install cocoapods.
I have recently changed to a monorepo setup for my react-native app. The filesystem is like this:
| package.json
| - native/
| - package.json
| - ios/
| - Podfile
| - .xcodeproj, .xcodeworkspace etc.
| - components/
| - src/
| - package.json
| - node_modules/
My root package.json:
{
"name": <name>,
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android --root ./native",
"ios": "react-native run-ios --project-path './native/ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"flow": "flow"
},
"workspaces": ["components", "native", "web"],
"dependencies": {
"react": "16.13.1",
"react-native": "^0.63.1"
}
}
My /components/package.json:
{
"name": "components",
"version": "1.0.0",
"dependencies": {
"react": "^16.13.1",
"react-native": "^0.63.1",
all my source project dependencies
},
}
My native/package.json:
{
"name": "native",
"version": "1.0.0",
"dependencies": {
"components": "1.0.0",
"react": "^16.13.1",
"react-native": "^0.63.1"
}
}
Changing that to config[:reactNativePath] works for me.
Changing that to
config[:reactNativePath]works for me.
Thanks! That fixed it.
Changing that to
config[:reactNativePath]works for me.
This work for me
Changing that to
config[:reactNativePath]works for me.
Hi @stackia what's the difference here? I found that the flipper's doc is still using the string way: https://fbflipper.com/docs/getting-started/react-native-ios/
Changing that to
config[:reactNativePath]works for me.Hi @stackia what's the difference here? I found that the flipper's doc is still using the string way: https://fbflipper.com/docs/getting-started/react-native-ios/
@xilin It's how hash keys are accessed in Ruby, by symbol :something or string "something" but not both (unless you use ActiveSupport type stuff). I don't know where that source code exists, but my guess is they changed to perform something like symbolize_keys to normalize them and missed updating the docs.
Most helpful comment
Changing that to
config[:reactNativePath]works for me.