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 not building on Xcode 12.5 #31592

Closed
yepes opened this issue May 26, 2021 · 13 comments
Closed

React Native not building on Xcode 12.5 #31592

yepes opened this issue May 26, 2021 · 13 comments
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.

Comments

@yepes
Copy link

yepes commented May 26, 2021

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Created a RN blank project on a new mac mini m1 apple silicon. SO: Big Sur 11.3.1

npx react-native init AwesomeProject

After that, yarn ios works fine. The app is launched correctly on the ios simulator.

if I open Xcode and try to build, I get this error:

Showing All Messages
/Users/myusername/Proyectos/AwesomeProject/ios/AwesomeProject.xcodeproj The linked library 'libPods-AwesomeProject.a' is missing one or more architectures required by this target: arm64.

React Native version:

"dependencies": {
    "react": "17.0.1",
    "react-native": "0.64.1"
  },

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Create a blank RN default project on an apple m1 computer
  2. Check that yarn ios works just fine
  3. Try to open ios/AwesomeProject.xcworkspace and hit play
  4. The above error should appear

Expected Results

The app should work when yarn ios and when running in xcode

Snack, code example, screenshot, or link to a repository:

Just the default code created by npx react-native init AwesomeProject

@yepes
Copy link
Author

yepes commented May 26, 2021

Just having a look at this issue, adding arm64 to excluded architectures seems to work. I'm not exactly sure if this is the correct way to solve this, or what implication will this have in the future:

image

Can anyone with an m1 computer please confirm this?

@dulmandakh
Copy link
Contributor

@yepes could you please test #31622

@yepes
Copy link
Author

yepes commented May 28, 2021

@dulmandakh how am i supposed to test that PR? do I have to init a new RN project and apply your changes to my node modules and try?

@dulmandakh
Copy link
Contributor

Edit node_modules/react-native/scripts/find-node.sh and append content of the PR. And see if it solves your issue. Thanks

@yepes
Copy link
Author

yepes commented May 28, 2021

@dulmandakh I tried it but doesn't work:

Showing All Messages
/Users/xxxxxxxxx/Proyectos/rn64/ios/rn64.xcodeproj The linked library 'libPods-rn64.a' is missing one or more architectures required by this target: arm64.

Looking your PR it seems that what you are doing is just checking if /opt/homebrew/bin exists and adding it to the path. I don't know if this is related with the issue I am facing.

Anyway, I didn't install node using homebrew (when I bought the mm was impossible) and have installed manually:

which node
/usr/local/bin/node

facebook-github-bot pushed a commit that referenced this issue Jun 2, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes #31621 #31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: #31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
kelset pushed a commit that referenced this issue Jun 3, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes #31621 #31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: #31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec

# Conflicts:
#	scripts/find-node.sh
Titozzz pushed a commit to Titozzz/react-native that referenced this issue Jun 7, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
Titozzz pushed a commit to Titozzz/react-native that referenced this issue Jun 7, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
tido64 pushed a commit that referenced this issue Jun 8, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes #31621 #31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: #31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
danilobuerger pushed a commit to feastr/react-native that referenced this issue Jun 9, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
Setito pushed a commit to Setito/react-native that referenced this issue Jul 17, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

## Changelog

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
@chriskrogh
Copy link

chriskrogh commented Jul 23, 2021

Running into this issue as well on an M1 Mac, however I'm also using nvm to manage my node version. This was on a fresh project created using npx react-native init MyApp --template react-native-template-typescript. For me, the app does not build using yarn ios (gist of verbose output) Installing node via Homebrew does not resolve the issue either.

package.json

"dependencies": {
  "react": "17.0.1",
  "react-native": "0.64.1"
},

xcodebuild -version

Xcode 12.5.1
Build version 12E507

which node

/Users/chriskrogh/.nvm/versions/node/v16.3.0/bin/node

@tido64
Copy link
Collaborator

tido64 commented Jul 23, 2021

package.json

"dependencies": {
  "react": "17.0.1",
  "react-native": "0.64.1"
},

Can you try bumping react-native to 0.64.2? The issue should be fixed already. I don't know who owns react-native-template-typescript, but you should tell them to bump react-native to latest.

@yepes
Copy link
Author

yepes commented Jul 23, 2021

I'm using the same mac mini. I just recreated a new project:

npx react-native init AwesomeProject

package.json:

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "17.0.1",
    "react-native": "0.64.2"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "17.0.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

yarn ios works fine.

Xcode doesn't

I openned ios/AwesomeProject.xcworkspace
Hit play selecting iphone12 14.5. I get this error almost instantly:

/Users/myusername/Proyectos/AwesomeProject/ios/AwesomeProject.xcodeproj The linked library 'libPods-AwesomeProject.a' is missing one or more architectures required by this target: arm64.

Following the steps I suggested in #31592 (comment) works.

So, the issue is still there.

@kelset
Copy link
Contributor

kelset commented Jul 23, 2021

I'm not a big fan of duplication, so I'm going to close this.

For M1 specific issues, please comment here -> #31438
And for the Xcode 12.5 situation, refer to this troubleshooting guide -> #31480

@kelset kelset closed this as completed Jul 23, 2021
@yepes
Copy link
Author

yepes commented Jul 23, 2021

With all respect, you linked to a closed issue and to an issue that has nothing to do with this.

IMO, the default template should work fine after a clean install

@kelset
Copy link
Contributor

kelset commented Jul 23, 2021

you linked to a closed issue

Neither of those are closed?

has nothing to do with this.

Which one?

@yepes
Copy link
Author

yepes commented Jul 23, 2021

Sorry, i was on mobile and thought #31438 was closed. I will take a look at it.
#31480 doesn't seem the same problem i'm facing

@chriskrogh
Copy link

Can you try bumping react-native to 0.64.2?

Bumping to latest still doesn't work. I also followed the steps outlined #31480 (comment) and then here, and yarn ios still doesn't work.

danilobuerger pushed a commit to feastr/react-native that referenced this issue Oct 28, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
danilobuerger pushed a commit to feastr/react-native that referenced this issue Oct 28, 2021
Summary:
Homebrew on M1 installs executable binaries in **/opt/homebrew/bin** (See https://brew.sh/2021/02/05/homebrew-3.0.0/), and FBReactNativeSpec.build is failing because it couldn't find node. This PR changes find-node.sh script to add /opt/homebrew/bin into $PATH.

The way **react.gradle** trying to execute node is not using user environment variables, but system defaults, so it couldn't find it. I removed node execution, and hard coded cli path in parity with iOS https://github.com/facebook/react-native/blob/d1ab03235cb4b93304150878d2b9057ab45bba77/scripts/react-native-xcode.sh#L106

Fixes facebook#31621 facebook#31592

[General] [Changed] - find-node.sh supports Homebrew on M1

Pull Request resolved: facebook#31622

Test Plan: On M1, create a RN project and it'll fail to build iOS app. Apply the patch, and build will succeed.

Reviewed By: ShikaSD

Differential Revision: D28808206

Pulled By: hramos

fbshipit-source-id: 8b313b6685462a15e67d99c61a0202d17fece1ec
@facebook facebook locked as resolved and limited conversation to collaborators Jul 23, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants