Podfile:
use_modular_headers!
#platform :ios, '15.0' # Specify the minimum iOS version
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
target 'copiaReactnativeApp' do
use_react_native!(
:path => use_native_modules![:reactNativePath],
:app_path => "#{Pod::Config.instance.installation_root}/..",
:hermes_enabled => true
)
target 'copiaReactnativeAppTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
react_native_path = use_native_modules![:reactNativePath]
react_native_post_install(
installer,
react_native_path,
:mac_catalyst_enabled => false
)
end
end
And I would get this error:
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Auto-linking React Native modules for target `copiaReactnativeApp`: Picker, RNCMaskedView, RNCPicker, RNFBApp, RNGestureHandler, RNReanimated, RNScreens, react-native-config, react-native-image-picker, and react-native-safe-area-context
Framework build type is static library
[!] Invalid `Podfile` file: exit.
# from {path}/ios/Podfile:13
# -------------------------------------------
# target 'copiaReactnativeApp' do
> use_react_native!(
# :path => use_native_modules![:reactNativePath],
# -------------------------------------------
[!] Unable to remove the content of {path}/copia-react-native-app/ios/../ios/build/generated/ios folder. Please run rm -rf {path}/copia-react-native-app/ios/../ios/build/generated/ios and try again.
Then I tried adding:
plugin 'react_native_post_install', {
'react_native_path' => '../node_modules/react-native',
'use_modular_headers' => true
}
and
platform :ios, '15.0'
target 'copiaReactnativeApp' do
use_react_native!(
:path => '../node_modules/react-native',
:app_path => "#{Pod::Config.instance.installation_root}/..",
:hermes_enabled => true
)
end
Error:
Your Podfile requires that the plugin `react_native_post_install` be installed. Please install it and try installation again.
I have tried uninstalling Cocoapods and reinstalling, Ive tried these as well:
npx pod-install, pod install, gem install cocoapods-react-native-post-install, gem update --system, pod cache clean --all, bundle install, pod setup
I am able to run my app still by using npm start
and then opening my simulator. It does give me this error though:
Error: xcodebuild: error: Unable to read project 'copiaReactnativeApp.xcodeproj'.
Versions
react-native: 0.73.4
react-native-cli: 2.0.1
Ruby: 3.0.0
Cocoapods: 1.15.2
I fixed it by doing the following
whoami
to get the current user.sudo chown -R ownerName: /path/to/node_modules
I found it from this comment.