即使我尝试运行模拟,我仍然遇到脚本问题、iPhone 版本范围问题和模拟器问题。
如有任何帮助,我们将不胜感激。 ReactNative 新手。我的团队中没有人可以帮助我。
#项目环境
mac M2
ruby -v
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
node -v
v20.10.0
pod --version
1.15.2
package.json
{
"name": "labts",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"@react-native-community/async-storage": "^1.12.1",
"@react-native-community/cli": "13.6.9",
"@react-navigation/bottom-tabs": "^6.6.0",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.10.0",
"@tanstack/react-query": "^5.51.5",
"@types/react-native-vector-icons": "^6.4.18",
"axios": "^1.7.2",
"date-fns": "^3.6.0",
"immer": "^10.1.1",
"react": "18.2.0",
"react-native": "0.74.3",
"react-native-calendars": "^1.1305.0",
"react-native-date-picker": "^5.0.4",
"react-native-dotenv": "^3.4.11",
"react-native-get-random-values": "^1.11.0",
"react-native-image-crop-picker": "^0.41.2",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-paper": "^5.12.3",
"react-native-permissions": "^4.1.5",
"react-native-safe-area-context": "^4.10.8",
"react-native-screens": "^3.32.0",
"react-native-splash-screen": "^3.3.0",
"react-native-tab-view": "^3.5.2",
"react-native-vector-icons": "^10.1.0",
"react-native-vision-camera": "^4.5.1",
"uuid": "^10.0.0",
"yarn": "^1.22.22"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.85",
"@react-native/eslint-config": "0.74.85",
"@react-native/metro-config": "0.74.85",
"@react-native/typescript-config": "0.74.85",
"@types/react": "^18.2.6",
"@types/react-native-dotenv": "^0.2.2",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"babel-plugin-module-resolver": "^5.0.2",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}
Pod文件
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, '12.0'
use_frameworks!
#use_modular_headers!
prepare_react_native_project!
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
target 'nexlabts' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'nexlabtsTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
end
end
##Xcode 设置图片 在此输入图片描述
错误1。
当我安装 cocoapods 时。
[!] CocoaPods could not find compatible versions for pod "React-RuntimeHermes": In Podfile: React-RuntimeHermes (from ../node_modules/react-native/ReactCommon/react/runtime)
Specs satisfying the React-RuntimeHermes (from ../node_modules/react-native/ReactCommon/react/runtime) dependency were found, but they required a higher minimum deployment target.
错误2。当我运行 ios --no-packager --simulator="iPhone 15"
Build description signature: fc1341421f84b87c5245d346c2c17b66 Build description path: /Users/nowonjae/Library/Developer/Xcode/DerivedData/nexlabts-argvodqcybjfcybstpulfpghnzvm/Build/Intermediates.noindex/XCBuildData/fc1341421f84b87c5245d346c2c17b66.xcbuilddata /Users/nowonjae/Desktop/project/NeXLabRN/ios/nexlabts.xcodeproj:1:1: error: Unable to open base configuration reference file '/Users/nowonjae/Desktop/project/NeXLabRN/ios/Pods/Target Support Files/Pods-nexlabts/Pods-nexlabts.release.xcconfig'. (in target 'nexlabts' from project 'nexlabts') warning: Unable to read contents of XCFileList '/Target Support Files/Pods-nexlabts/Pods-nexlabts-resources-Release-output-files.xcfilelist' (in target 'nexlabts' from project 'nexlabts') warning: Unable to read contents of XCFileList '/Target Support Files/Pods-nexlabts/Pods-nexlabts-frameworks-Release-output-files.xcfilelist' (in target 'nexlabts' from project 'nexlabts') error: Unable to load contents of file list: '/Target Support Files/Pods-nexlabts/Pods-nexlabts-frameworks-Release-input-files.xcfilelist' (in target 'nexlabts' from project 'nexlabts') error: Unable to load contents of file list: '/Target Support Files/Pods-nexlabts/Pods-nexlabts-frameworks-Release-output-files.xcfilelist' (in target 'nexlabts' from project 'nexlabts') warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'nexlabts' from project 'nexlabts') warning: Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'nexlabts' from project 'nexlabts') error: Unable to load contents of file list: '/Target Support Files/Pods-nexlabts/Pods-nexlabts-resources-Release-input-files.xcfilelist' (in target 'nexlabts' from project 'nexlabts') error: Unable to load contents of file list: '/Target Support Files/Pods-nexlabts/Pods-nexlabts-resources-Release-output-files.xcfilelist' (in target 'nexlabts' from project 'nexlabts') warning: Run script build phase '[CP] Copy Pods Resources' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'nexlabts' from project 'nexlabts')
--- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:iOS Simulator, id:B5AA2E84-4F83-4749-A986-A1FCE5E398A3, OS:17.5, name:iPhone 15 } { platform:iOS Simulator, id:B5AA2E84-4F83-4749-A986-A1FCE5E398A3, OS:17.5, name:iPhone 15 } ** BUILD FAILED ** ]
错误3。当我在 Xcode 中构建时(任何 iOS 模拟器设备(arm64、x86_64))
Command PhaseScriptExecution failed with a nonzero exit code
#我做了什么来修复这个错误 我尝试的处理方法是重新安装cocoappods、删除Pods文件、删除缓存等
1. reinstall node
delete node_module, package-rock.json.
then
npm install --legacy-peer-deps
yarn install
2. set Xcode read node
sudo ln -s "$(which node)" /usr/local/bin/node
3. Edit Podfile
platform: ios, "12.0"
or
platform: ios, "14.0"
4. reinstall Pods
rm -rf ~/Library/Developer/Xcode/DerivedData
or
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf Pods
rm Podfile.lock
pod install --repo-update
Xcode \> Product \> Clean Build Folder.
cd ./ios
pod cache clean -all
pod install --repo-update
cd ../
npx react-native run-ios --no-packager --simulator="iPhone 15"
or
npx react-native run-ios --simulator="iPhone 15" or yarn start > i(run ios)
我想建造。
如果您仍然面临同样的问题,这对我有用:我有
平台:ios,'13.0'
在我的 Podfile 中,我将其更改为:
平台:ios,min_ios_version_supported
进行此更改后,一切对我来说都很完美。我希望这有帮助!