'"pod install" error in ReactNative m1 mac, Babel 5 is no longer being maintained. Upgrade to Babel 6

I'm running my project on node version 17.8.0 and npm with 6.14.10. As I try to install the pod it fails with the below command but it's working fine in Android:

enter image description here

As the above error log is requesting to upgrade the Babel-Core version to 6 but I've upgraded it to version 7 but still, I'm getting the same error. There are more other versions to upgrade/downgrade and issues to be fixed. I'm confused, about how to resolve these issues. Here are my dependencies used in the project:

"dependencies": {
    "@dudigital/react-native-zoomable-view": "^1.0.12",
    "@react-native-community/netinfo": "^4.4.0",
    "axios": "^0.26.1",
    "bluebird": "^3.5.3",
    "buffer": "^5.2.1",
    "connect": "^3.7.0",
    "d3-scale": "^2.2.2",
    "hoist-non-react-statics": "^3.2.1",
    "jetifier": "^1.6.8",
    "link": "^0.1.5",
    "lodash": "^4.17.11",
    "moment": "^2.24.0",
    "npm": "^6.14.10",
    "prop-types": "^15.6.2",
    "qs": "^6.6.0",
    "react": "16.6.3",
    "react-native": "^0.68.0",
    "react-native-communications": "^2.2.1",
    "react-native-document-picker": "^2.2.0",
    "react-native-extended-stylesheet": "^0.11.1",
    "react-native-firebase": "5.1.0",
    "react-native-floating-action": "^1.14.2",
    "react-native-geolocation-service": "^3.0.0",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-gifted-chat": "^0.7.2",
    "react-native-image-picker": "^4.7.3",
    "react-native-image-resizer": "^1.0.0",
    "react-native-linear-gradient": "^2.5.3",
    "react-native-localization": "^2.0.3",
    "react-native-map-link": "^2.1.6",
    "react-native-material-ripple": "^0.8.0",
    "react-native-message-bar": "^2.0.10",
    "react-native-mime-types": "^2.2.1",
    "react-native-open-settings": "^1.0.1",
    "react-native-orientation": "^3.1.3",
    "react-native-photo-view": "github:alwx/react-native-photo-view#e28f5416574cbfa07b2d4fa862c0048df56f7b02",
    "react-native-reanimated": "^1.8.0",
    "react-native-screens": "^2.7.0",
    "react-native-search-filter": "^0.1.4",
    "react-native-super-grid": "^3.0.1",
    "react-native-svg": "^8.0.10",
    "react-native-svg-charts": "^5.2.0",
    "react-native-svg-icon": "^0.8.1",
    "react-native-ui-components": "^0.5.0",
    "react-native-video": "^4.4.0",
    "react-native-webview": "^7.4.3",
    "react-navigation": "^3.0.9",
    "react-redux": "^6.0.0",
    "react-websocket": "^2.1.0",
    "recompose": "^0.30.0",
    "redux": "^4.0.1",
    "redux-define": "^1.1.1",
    "redux-logger": "^3.0.6",
    "redux-persist": "^5.10.0",
    "redux-persist-error-handler": "^0.1.1",
    "redux-persist-filesystem-storage": "^1.3.2",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0",
    "rn-fetch-blob": "^0.10.15",
    "rn-viewpager": "^1.2.9",
    "sanitize-filename": "^1.6.1",
    "shallow-equal": "^1.1.0",
    "tcomb-form-native": "^0.6.20",
    "uuid": "^3.3.2"
  },
  "devDependencies": {
    "@babel/core": "^7.17.9",
    "@babel/eslint-parser": "^7.17.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "24.1.0",
    "eslint": "^4.19.1",
    "jest": "24.1.0",
    "metro-react-native-babel-preset": "0.59.0",
    "react-test-renderer": "16.6.3"
  }

Podfile:

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'

pod 'Firebase/Core'
pod 'Firebase/Database', '~> 5.15.0'
pod 'Firebase/Storage', '~> 5.15.0'
pod 'Firebase/Messaging', '~> 5.15.0'

# pod "Yoga", :path => "../node_modules/react-native/ReactCommon/yoga"
# pod 'React-Core', :path => '../node_modules/react-native/'
# pod 'DevSupport', :path => '../node_modules/react-native/'
# pod 'React-Core', :path => '../node_modules/react-native/'
# pod 'React', :path => '../node_modules/react-native', :subspecs => [
# 'Core',
# 'DevSupport',
# 'RCTNetwork',
# 'RCTWebSocket'
# ]

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == "React"
            target.remove_from_project
        end
    end
end

target 'PMIS' do

  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for PMIS

  # this is needed to avoid including multiple references to react.

  pod 'react-native-video', :path => '../node_modules/react-native-video'

  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  pod 'react-native-webview', :path => '../node_modules/react-native-webview'

end


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source