0

I upgraded React Native from 0.70.7 to 0.74, but I am getting the following error.

** BUILD FAILED **


The following build commands failed:
        PhaseScriptExecution [CP-User]\ Config\ codegen /Users/hakanuysal/Library/Developer/Xcode/DerivedData/myProject-dzmuzwuniukjeedngibspubvfwbd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-config.build/Script-46EB2E00042F70.sh (in target 'react-native-config' from project 'Pods')
(1 failure)

error Command failed with exit code 1.

package.json:

{
  "name": "myProject",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "android": "react-native run-android --variant=productiondebug --appId com.myProject",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "ios:beta": "react-native run-ios --scheme 'myProjectStaging'  --configuration 'StagingDebug'",
    "test": "jest",
    "lint": "eslint --ext src/**/*.{js,ts,tsx}",
    "clean": "cd android && ./gradlew clean && rm -rf ~/.gradle/caches/build-cache-* && ./gradlew --stop && cd .. && watchman watch-del-all && rm -rf node_modules/ && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* &&  yarn cache clean && yarn install && cd ios && rm -rf Podfile.lock && rm -rf Pods/ && pod install && cd .. && yarn start --reset-cache",
    "metro-clean": "watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* &&  yarn cache clean && yarn start --reset-cache",
    "cache-clean": "yarn start --reset-cache",
    "postinstall": "patch-package",
    "prettier:write": "yarn prettier --write src/**/*.{js,ts,tsx,json}",
    "package-check": "npm-check -i @myProject/* -p",
    "package-check:dev": "npm-check -i @myProject/* -d",
    "build-android:apk": "cd android && ./gradlew clean && rm -rf ~/.gradle/caches/build-cache-* && ./gradlew --stop && watchman watch-del-all && ./gradlew assembleProductionRelease && ./gradlew --stop",
    "build-android-market": "cd android && ./gradlew bundleProductionRelease"
  },
  "dependencies": {
    "@eva-design/eva": "^2.1.1",
    "@invertase/react-native-apple-authentication": "^2.2.2",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-clipboard/clipboard": "1.14.1",
    "@react-native-community/datetimepicker": "8.0.0",
    "@react-native-firebase/analytics": "19.2.2",
    "@react-native-firebase/app": "19.2.2",
    "@react-native-firebase/auth": "19.2.2",
    "@react-native-firebase/crashlytics": "19.2.2",
    "@react-native-firebase/database": "19.2.2",
    "@react-native-firebase/messaging": "19.2.2",
    "@react-native-firebase/perf": "19.2.2",
    "@react-native-google-signin/google-signin": "^11.0.1",
    "@react-native-masked-view/masked-view": "0.3.1",
    "@react-navigation/bottom-tabs": "6.5.20",
    "@react-navigation/drawer": "6.6.15",
    "@react-navigation/elements": "1.3.30",
    "@react-navigation/native": "6.1.17",
    "@react-navigation/stack": "6.3.29",
    "@reduxjs/toolkit": "2.2.3",
    "@rnhooks/keyboard": "^1.1.0",
    "@sentry/react-native": "5.22.0",
    "@ui-kitten/components": "^5.1.2",
    "@ui-kitten/eva-icons": "^5.1.2",
    "axios": "1.6.8",
    "deprecated-react-native-prop-types": "^5.0.0",
    "expo": "^50.0.17",
    "expo-linear-gradient": "12.7.2",
    "expo-screen-orientation": "6.4.1",
    "i18next": "23.11.3",
    "lodash": "^4.17.21",
    "lottie-ios": "4.4.1",
    "lottie-react-native": "6.7.2",
    "metro": "0.80.8",
    "moment": "2.30.1",
    "moment-duration-format": "^2.3.2",
    "prop-types": "^15.8.1",
    "react": "18.3.1",
    "react-i18next": "14.1.1",
    "react-native": "0.74.0",
    "react-native-adjust": "4.38.1",
    "react-native-agora": "4.3.0-build.1",
    "react-native-bootsplash": "5.5.3",
    "react-native-code-push": "8.2.2",
    "react-native-confetti-cannon": "^1.5.2",
    "react-native-config": "1.5.0",
    "react-native-device-info": "10.13.2",
    "react-native-dialog": "^9.2.2",
    "react-native-fast-image": "8.6.3",
    "react-native-fbsdk-next": "^13.0.0",
    "react-native-flash-message": "0.4.2",
    "react-native-gesture-handler": "2.16.1",
    "react-native-gifted-chat": "2.4.0",
    "react-native-google-mobile-ads": "13.2.0",
    "react-native-gradle-plugin": "^0.71.19",
    "react-native-hyperlink": "^0.0.22",
    "react-native-inappbrowser-reborn": "^3.7.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-localize": "3.1.0",
    "react-native-mmkv": "2.12.2",
    "react-native-modal": "^13.0.1",
    "react-native-modal-datetime-picker": "17.1.0",
    "react-native-pager-view": "6.3.1",
    "react-native-permissions": "3.0.4",
    "react-native-purchases": "7.27.1",
    "react-native-reanimated": "^3.10.0",
    "react-native-restart": "^0.0.27",
    "react-native-safe-area-context": "^4.10.1",
    "react-native-screens": "3.31.1",
    "react-native-snackbar": "^2.4.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-store-review": "^0.4.3",
    "react-native-svg": "^15.2.0",
    "react-native-swipe-list-view": "^3.2.9",
    "react-native-tab-view": "3.5.2",
    "react-native-vector-icons": "10.0.3",
    "react-native-walkthrough-tooltip": "^1.6.0",
    "react-redux": "9.1.1",
    "redux": "5.0.1",
    "socket.io-client": "4.7.5"
  },
  "devDependencies": {
    "@babel/core": "^7.24.5",
    "@babel/plugin-proposal-decorators": "7.24.1",
    "@babel/plugin-syntax-typescript": "7.24.1",
    "@babel/preset-typescript": "7.24.1",
    "@babel/runtime": "^7.24.5",
    "@react-native-community/eslint-config": "^3.2.0",
    "@sentry/types": "^7.112.2",
    "@types/eslint": "^8.56.10",
    "@types/jest": "29.5.12",
    "@types/lodash": "^4.17.0",
    "@types/react": "^18.2.6",
    "@types/react-dom": "^18.3.0",
    "@types/react-native": "^0.73.0",
    "@types/react-native-snap-carousel": "^3.8.11",
    "@types/react-redux": "7.1.33",
    "@types/react-test-renderer": "^18.3.0",
    "@typescript-eslint/eslint-plugin": "7.8.0",
    "@typescript-eslint/parser": "7.8.0",
    "@ui-kitten/metro-config": "^5.1.2",
    "babel-jest": "^29.7.0",
    "babel-plugin-module-resolver": "^5.0.2",
    "babel-plugin-transform-inline-environment-variables": "0.4.4",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint": "9.1.1",
    "eslint-config-prettier": "^9.1.0",
    "eslint-config-standard": "^17.0.0",
    "eslint-config-universe": "^12.0.1",
    "eslint-import-resolver-typescript": "^3.5.1",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-prettier": "^5.1.3",
    "eslint-plugin-promise": "^6.0.1",
    "eslint-plugin-react": "^7.34.1",
    "eslint-plugin-react-hooks": "^4.6.2",
    "eslint-plugin-standard": "^5.0.0",
    "jest": "^29.7.0",
    "metro-react-native-babel-preset": "0.77.0",
    "patch-package": "^8.0.0",
    "postinstall-postinstall": "^2.1.0",
    "prettier": "^3.2.5",
    "pretty-quick": "^4.0.0",
    "react-test-renderer": "18.3.1",
    "ts-jest": "29.1.2",
    "typescript": "5.4.5"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  },
  "expo": {
    "autolinking": {
      "exclude": [
        "react-native-reanimated"
      ]
    }
  }
}

podfile:

use_modular_headers!

$RNFirebaseAsStaticFramework = true
$RNFirebaseAnalyticsWithoutAdIdSupport=true
$RNGoogleMobileAdsAsStaticFramework = true

pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '14.0'
install! 'cocoapods', :deterministic_uuids => false

project 'myProject',
        'DevDebug' => :debug,
        'DevRelease' => :release,
        'StagingDebug' => :debug,
        'StagingRelease' => :release,
        'Debug' => :debug,
        'Release' => :release

target 'myProject' do
  use_expo_modules!
  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end

  config = use_native_modules!
  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => false,
    :fabric_enabled => false,
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

  ## Firebase pods
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    # __apply_Xcode_12_5_M1_post_install_workaround(installer)
    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end
end

2 Answers 2

0

I'm still having the same problem, I couldn't fix it. Even though the env file is correct, react-native config gives an error regarding env. xcode logs :

PhaseScriptExecution [CP-User]\ Config\ codegen /Users/hakanuysal/Library/Developer/Xcode/DerivedData/myProject-eujtnqadlxnqlhamrqbzdnhghsji/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-config.build/Script-46EB2E00043140.sh (in target 'react-native-config' from project 'Pods')
1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 5 at 15:38
-1

Upgrading React Native can sometimes trip things up with your setup. It looks like your build scripts might be out of sync with the new version. Here’s what I suggest to get things back on track:

Firstly: Try Clean House

You can start a fresh by cleaning up and setting things up again:

Clear out old watchman data and reset Metro's cache

watchman watch-del-all rm -rf $TMPDIR/react-native-packager-cache-* rm -rf $TMPDIR/metro-bundler-cache-*

Remove old modules and re-install

rm -rf node_modules/ && yarn install

Now, head over to iOS and clean up there as well

cd ios rm -rf Pods Podfile.lock pod install --repo-update cd ..

Secondly, Try checking your build scripts:

That error you’re seeing seems to come from react-native-config. There might be a script that needs an update in your Xcode project settings under the Pods target. Make sure it’s all good for React Native 0.74

#I hope this will help

1
  • I tried these but it didn't provide a solution :( Commented May 2 at 20:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.