Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native requires XCode >= 14.3. Found 14.2 #44384

Closed
shahjahanpak opened this issue May 2, 2024 · 14 comments
Closed

React Native requires XCode >= 14.3. Found 14.2 #44384

shahjahanpak opened this issue May 2, 2024 · 14 comments
Labels
Resolution: Answered When the issue is resolved with a simple answer Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@shahjahanpak
Copy link

shahjahanpak commented May 2, 2024

Description

Initialising a new project and running pod install throws this error

React Native requires XCode >= 14.3. Found 14.2.

[!] Invalid `Podfile` file: Please upgrade XCode.

 #  from project/ios/Podfile:20
 #  -------------------------------------------
 #  
 >    use_react_native!(
 #      :path => config[:reactNativePath],
 #  -------------------------------------------

Steps to reproduce

  1. npx react-native@latest init AwesomeProject
  2. cd AwesomeProject/ios
  3. pod install

React Native Version

0.74.0

Affected Platforms

Runtime - Android, Runtime - iOS

Areas

Bridgeless - The New Initialization Flow

Output of npx react-native info

System:
  OS: macOS 12.7.4
  CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
  Memory: 152.50 MB / 16.00 GB
  Shell:
    version: 5.8.1
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2024.03.18.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.2
      - iOS 16.2
      - macOS 13.1
      - tvOS 16.1
      - watchOS 9.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 14.2/14C18
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/mac/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.0
    wanted: 0.74.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

$ /Users/mac/.nvm/versions/node/v20.11.1/bin/node -p require.resolve(     "react-native/scripts/react_native_pods.rb",     {paths: [process.argv[1]]},   )
  /Users/mac/Desktop/projects/AwesomeProject/ios
  /Users/mac/Desktop/projects/AwesomeProject/node_modules/react-native/scripts/react_native_pods.rb
  $ /Users/mac/.nvm/versions/node/v20.11.1/bin/node -p require.resolve(     "@react-native-community/cli-platform-ios/native_modules.rb",     {paths:
  [process.argv[1]]},   ) /Users/mac/Desktop/projects/AwesomeProject/node_modules/react-native/scripts
  /Users/mac/Desktop/projects/AwesomeProject/node_modules/@react-native-community/cli-platform-ios/native_modules.rb
  $ /Users/mac/.nvm/versions/node/v20.11.1/bin/node -e try {console.log(require('@react-native-community/cli').bin);} catch (e)
  {console.log(require('react-native/cli').bin);}
  /Users/mac/Desktop/projects/AwesomeProject/node_modules/@react-native-community/cli/build/bin.js
React Native requires XCode >= 14.3. Found 14.2.

[!] Invalid `Podfile` file: Please upgrade XCode.

 #  from /Users/mac/Desktop/projects/AwesomeProject/ios/Podfile:20
 #  -------------------------------------------
 #  
 >    use_react_native!(
 #      :path => config[:reactNativePath],
 #  -------------------------------------------

/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:335:in `rescue in block in from_ruby'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:329:in `block in from_ruby'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:50:in `instance_eval'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:50:in `initialize'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:327:in `new'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:327:in `from_ruby'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:293:in `from_file'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/config.rb:206:in `podfile'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:46:in `run'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.15.2/libexec/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.15.2/libexec/bin/pod:25:in `load'
/usr/local/Cellar/cocoapods/1.15.2/libexec/bin/pod:25:in `<main>'

Reproducer

https://github.com/shahjahanpak/AwesomeProject

Screenshots and Videos

Screenshot 2024-05-02 at 11 43 17 AM
@shahjahanpak shahjahanpak added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels May 2, 2024
Copy link

github-actions bot commented May 2, 2024

⚠️ Add or Reformat Version Info
ℹ️ We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2

@cortinico
Copy link
Contributor

React Native requires XCode >= 14.3. Found 14.2.

The error is self explanatory: you need to update XCode version.
Please update XCode version and get back to use if the issue persists

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Author Feedback Needs: Version Info labels May 2, 2024
@HunnySajid
Copy link

HunnySajid commented May 4, 2024

React Native requires XCode >= 14.3. Found 14.2.

The error is self explanatory: you need to update XCode version. Please update XCode version and get back to use if the issue persists

The problem is xcode 14.3 requires MacOS 13.3, my current macbook (MacBook Pro (Retina, 15-inch, Mid 2015)) only offers an update to MacOS 12.7.4.
Is there a way I can run react-native without making these updates?
Maybe downgrading the react-native to a specific version...

@DanTol-cloud
Copy link

The same issue exactly is there any solution for this?

React Native requires XCode >= 14.3. Found 14.2.

The error is self explanatory: you need to update XCode version. Please update XCode version and get back to use if the issue persists

The problem is xcode 14.3 requires MacOS 13.3, my current macbook (MacBook Pro (Retina, 15-inch, Mid 2015)) only offers an update to MacOS 12.7.4. Is there a way I can run react-native without making these updates? Maybe downgrading the react-native to a specific version...

The same issue exactly. Is there a solution?

@cortinico
Copy link
Contributor

Nope sorry. Those limitations are imposed by Apple and outside our control

@mustafaerken
Copy link

I have same issue:

Device: MacBook Pro (Retina, 15-inch, Mid 2015).
macOS: 12.7.4 (Monterey).
xCode: 14.2 (This is the last version for my MacBook Pro 2015.).
ReactNative: I tried 0.71.7 and 0.74.1

There is a problem when we open projects or pod install.

@mustafaerken
Copy link

I fixed my problem with making new project with;

npx react-native init App01 --version 0.71.7

I hope this helps.

@HunnySajid
Copy link

I fixed my problem with making new project with;

npx react-native init App01 --version 0.71.7

I hope this helps.

It also worked for me once I downgraded react-native to 0.71.7
Thank you

@Rajavicky07
Copy link

Rajavicky07 commented May 7, 2024

I fixed my problem with making new project with;

npx react-native init App01 --version 0.71.7

I hope this helps.

how to show this issue my xcode version 14.1 i couldn't install 14.3 xcode version is helps
npx react-native init App01 --version 0.71.7 ?

@mustafaerken
Copy link

mustafaerken commented May 7, 2024

I fixed my problem with making new project with;
npx react-native init App01 --version 0.71.7
I hope this helps.

how to show this issue my xcode version 14.1 i couldn't install 14.3 xcode version is helps npx react-native init App01 --version 0.71.7 ?

We couldn't install xCode 14.3 so this helped us.
It should help you if you have similar problem.

@herhu
Copy link

herhu commented Jul 16, 2024

Nope sorry. Those limitations are imposed by Apple and outside our control

Hello , solution provided is buy a new MacBook but sometimes this is not too easy and many of us we want to develop in this case the Max solution from apple is use Xcode 14.2 and here RN we have to guess it because is not a version I can use ?

@yminfosys
Copy link

npx react-native init App01 --version 0.71.7

it works for me

thanks

@dipo1
Copy link

dipo1 commented Aug 12, 2024

Version 0.73.7 also works. I think it is the last version before deprecating XCode 14.2.
npx @react-native-community/cli@latest init --version=0.73.7

IMO, the rationale for removing support for XCode 14.2 is not sufficient. MacOS Monterey will no longer be compatible with recent React Native versions and that also means any MacBook Pro released before 2017.

See the commit message: 1021448

If you don't mind the "cryptic error", you can bypass this by changing the min_xcode_version_supported value in `node_modules/react-native/scripts/cocoapods/helpers.rb line 41

Bit-casting object representations feature is also used in Yoga which requires Xcode 14.3 or later. You can write you own bit_cast function to safely mimic std::bit_cast.

// node_modules/react-native/ReactCommon/yoga/yoga/style/StyleValuePool.h

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#pragma once

#include <cassert>
#include <cstdint>
+ #include <cstring> // For std::memcpy

#include <yoga/numeric/FloatOptional.h>
#include <yoga/style/SmallValueBuffer.h>
#include <yoga/style/StyleLength.h>
#include <yoga/style/StyleValueHandle.h>

namespace facebook::yoga {

+ template <typename To, typename From>
+ To bit_cast(const From& src) noexcept {
+     static_assert(sizeof(To) == sizeof(From), "Size mismatch in bit_cast");
+     static_assert(std::is_trivially_copyable<From>::value, "Source type must be trivially copyable");
+     static_assert(std::is_trivially_copyable<To>::value, "Destination type must be trivially copyable");
+     To dst;
+     std::memcpy(&dst, &src, sizeof(To));
+     return dst;
+ }
+ 
/**
 * StyleValuePool allows compact storage for a sparse collection of assigned
 * lengths and numbers. Values are referred to using StyleValueHandle. In most
 * cases StyleValueHandle can embed the value directly, but if not, the value is
 * stored within a buffer provided by the pool. The pool contains a fixed number
 * of inline slots before falling back to heap allocating additional slots.
 */
class StyleValuePool {
 public:
  void store(StyleValueHandle& handle, StyleLength length) {
    if (length.isUndefined()) {
      handle.setType(StyleValueHandle::Type::Undefined);
    } else if (length.isAuto()) {
      handle.setType(StyleValueHandle::Type::Auto);
    } else {
      auto type = length.unit() == Unit::Point
          ? StyleValueHandle::Type::Point
          : StyleValueHandle::Type::Percent;
      storeValue(handle, length.value().unwrap(), type);
    }
  }

  void store(StyleValueHandle& handle, FloatOptional number) {
    if (number.isUndefined()) {
      handle.setType(StyleValueHandle::Type::Undefined);
    } else {
      storeValue(handle, number.unwrap(), StyleValueHandle::Type::Number);
    }
  }

  StyleLength getLength(StyleValueHandle handle) const {
    if (handle.isUndefined()) {
      return value::undefined();
    } else if (handle.isAuto()) {
      return value::ofAuto();
    } else {
      assert(
          handle.type() == StyleValueHandle::Type::Point ||
          handle.type() == StyleValueHandle::Type::Percent);
      float value = (handle.isValueIndexed())
-           ? std::bit_cast<float>(buffer_.get32(handle.value()))
+           ? bit_cast<float>(buffer_.get32(handle.value()))
          : unpackInlineInteger(handle.value());

      return handle.type() == StyleValueHandle::Type::Point
          ? value::points(value)
          : value::percent(value);
    }
  }

  FloatOptional getNumber(StyleValueHandle handle) const {
    if (handle.isUndefined()) {
      return FloatOptional{};
    } else {
      assert(handle.type() == StyleValueHandle::Type::Number);
      float value = (handle.isValueIndexed())
-           ? std::bit_cast<float>(buffer_.get32(handle.value()))
+           ? bit_cast<float>(buffer_.get32(handle.value()))
          : unpackInlineInteger(handle.value());
      return FloatOptional{value};
    }
  }

 private:
  void storeValue(
      StyleValueHandle& handle,
      float value,
      StyleValueHandle::Type type) {
    handle.setType(type);

    if (handle.isValueIndexed()) {
      auto newIndex =
-           buffer_.replace(handle.value(), std::bit_cast<uint32_t>(value));
+           buffer_.replace(handle.value(), bit_cast<uint32_t>(value));
      handle.setValue(newIndex);
    } else if (isIntegerPackable(value)) {
      handle.setValue(packInlineInteger(value));
    } else {
-       auto newIndex = buffer_.push(std::bit_cast<uint32_t>(value));
+       auto newIndex = buffer_.push(bit_cast<uint32_t>(value));
      handle.setValue(newIndex);
      handle.setValueIsIndexed();
    }
  }

  static constexpr bool isIntegerPackable(float f) {
    constexpr uint16_t kMaxInlineAbsValue = (1 << 11) - 1;

    int32_t i = static_cast<int32_t>(f);
    return static_cast<float>(i) == f && i >= -kMaxInlineAbsValue &&
        i <= +kMaxInlineAbsValue;
  }

  static constexpr uint16_t packInlineInteger(float value) {
    uint16_t isNegative = value < 0 ? 1 : 0;
    return static_cast<uint16_t>(
        (isNegative << 11) |
        (static_cast<int32_t>(value) * (isNegative ? -1 : 1)));
  }

  static constexpr float unpackInlineInteger(uint16_t value) {
    constexpr uint16_t kValueSignMask = 0b0000'1000'0000'0000;
    constexpr uint16_t kValueMagnitudeMask = 0b0000'0111'1111'1111;
    const bool isNegative = (value & kValueSignMask) != 0;
    return static_cast<float>(
        (value & kValueMagnitudeMask) * (isNegative ? -1 : 1));
  }

  SmallValueBuffer<4> buffer_;
};

} // namespace facebook::yoga

PS; The fix was tested on RN 0.74.5. I also had to rollback the updates to LaunchScreen.storyboard file.

dipo1 referenced this issue Aug 12, 2024
Summary:
Pull Request resolved: #43583

Fail during `pod install` if user's version of XCode is too old to avoid cryptic errors (e.g. reactwg/react-native-releases#163).

I reused existing mechanism for version detection, though it may not be reliable for future versions of XCode.

Changelog:
[iOS][Changed] - Warn users during "pod install" if XCode is too old

Reviewed By: dmytrorykun

Differential Revision: D55149636

fbshipit-source-id: 78387ff19a6eb10f3ca0d4aa78e6b934ae3b0711
@iamunadike
Copy link

the saving grace is a fix called open-core patcher, yes perhaps you dont want to upgrade your macbook but want the latest os and do this and do that, Yes you can with Open-core patcher you can run the latest mac os on that old system it works even for Mac OS 10 and so on .so give it a shot , you can send me a tip and follow me as well if you liked this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Answered When the issue is resolved with a simple answer Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

10 participants