I'm reviewing the source code of a react native project, but I'm having issues building it.
After running the following
npm install
at the root of the projectpod install
at the ios folder
I got the following message in the terminal:
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' /Users/myUser/dev/ReactExplorerApp(Android)/ios/Pods/RCT-Folly/folly/portability/Time.h'
And when I build the application with XCode, I get the following error message at the Time.h (...Pods/RCT-Folly/folly/portability/Time.h):
Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')
The app uses "react-native": "0.66.1". I'm using cocoapods version 1.11.2, node version 14.17.2 and XCode version 13.1
Podfile content:
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'ExplorerApp' do
config = use_native_modules!
pod 'GoogleSignIn'
pod 'RNI18n', :path => '../node_modules/react-native-i18n'
pod 'react-native-version-check', :path => '../node_modules/react-native-version-check'
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
'FaceDetectorMLKit',
'BarcodeDetectorMLKit'
]
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
target 'ExplorerAppTests' 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 the next line.
use_native_modules!
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
I tried many solutions for similar issues, but didn't work. I tried disabling Flipper by commenting it out in the podfile and I also tried changing the target to iOS 12.
I also tried installing the pods after removing the podfile.lock and running pod install --repo-update
and I also ran pod cache clean --all
I also tried the solution here https://github.com/facebook/react-native/issues/31480 for "react-native": "0.64.1" // or higher
but it didn't work for me and I'm not clear on what they refer with "remove the relevant lines from the podfile.lock" if there are still errors.
Edit: [Solution] I got rid of this error by actually running
git clone [repo url]
in my terminal instead of using Azure DevOps's Clone button that interfaces with VSCode.
Had the same issue with MBP M1 2020 and react-native. Solution was to remove the space in my parent directory name. I did not have to do anything else.