error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65
Asked Answered
J

34

179

I've build a react-native application and suddenly I get this error message on my terminal during run of the command react-native run-ios. The same code work fine 10 minutes ago and suddenly I get this error message. Please help...

Juliannejuliano answered 19/3, 2019 at 7:46 Comment(6)
Always be sure to update your Xcode.Oxbridge
Did you install any new dependencies since it last worked? Have cleaned the build folder and the derived data?Cassatt
I have the same issue too, but I don't think XCode version is the problem.Streetman
Did you update react-native version? I had the same problem and I came back to the last RN version.Washedup
I downloaded my react-native version 5 days ago it is 2.0.1 versionJuliannejuliano
Were you able to resolve it?Classic
T
165

If you don't have cocoa pods installed you need to sudo gem install cocoapods

  1. run cd ios
  2. run pod install
  3. cd ..
  4. delete build folder
  5. run react-native run-ios

if the error persists,

  1. delete build folder again
  2. open the /ios folder in x-code
  3. navigate File -> Project Settings -> Build System -> change (Shared workspace settings and Per-User workspace settings): Build System -> Legacy Build System`

You should be good to go.

Tallbot answered 31/7, 2019 at 8:53 Comment(15)
hey dude , this one really worked for me! but u need to change something 1. cd ios only not cd/iosIkkela
Just removing build folder worked for me. I mean, steps 4 & 5 only.Patricepatrich
Step 2 alone (pod install) did it for me, thanks!Chemash
Where I can find build folder?Dance
Yep, there is no build folderAnthozoan
Where is build folder ? I'm using Mac 10.15.7 and XCode 11.7Koodoo
This doesn't work no more. Actually, if you use the Legacy Build System, the build can't even prepare lol.Roseline
Navigate to ios folder and pod install works for me.Alric
If youre on xcode 14 this does not work or exist?Ruffner
For those asking, build folder is actually inside the ios folderMeatus
build folder is in ios folder folks :)Candlepin
I don't see it in there, @DanielDanieleckiDanndanna
It's possible that you don't have a build folder, because your app has never been built for example. In that case, this step is unnecessary.Salvador
@Necmettin Sargın , It is in the ios folder, If you have not ran before then you can't see itSigman
@AliGhafoori thank you Ali but that question was from 2021 :DDance
A
41
  1. delete the build/ folder in ios/ and rerun if that doesn't do any change then
  2. File -> Project Settings (or WorkSpace Settings) -> Build System -> Legacy Build System
  3. Rerun and voilà!

In case this doesn't work, don't be sad, there is another solution to deeply clean project

  1. Delete ios/ and android/ folders.

  2. Run react-native eject [Edit: deprecated, so skip this step]

  3. Run react-native link

  4. react-native run-ios

This will bring a whole new resurrection for your project

[Edit] I solved this issue again by removing Pods and build folders, then running pod install in /ios.

Anzac answered 24/5, 2019 at 8:56 Comment(7)
I've try 2 times run the same command and now it works. 1) I removed the folder "/ios/build" and rerun. 2) After fail, I changed to Legacy Build System and rerun. 3) After fail, rerun again and voilà! :)Spittle
Thanks! The first solution worked for me. My case was that I moved a react-native project in another folder. That broke the npm run iOS for me.Pontefract
@Anzac Hi, do i still need to do pod install after resetting using the above method?Alaric
In my case there is no build folder under iOS/, please clarify how to get first placeKoodoo
Then you don't need to remove it :)Anzac
"eject" is deprecated and is no longer a valid command. Please update your answer.Cyclopedia
This is the right answer, and I believe this is needed every single time we update XCode.Golter
O
36

SOLVED: Always be sure to update your Xcode folks!

Protip: And don't do it from the apple store (but always do it from an official apple website of course)

tip from: http://ericasadun.com/2016/03/22/xcode-upgrades-lessons-learned/

official apple download page: https://developer.apple.com/download/more/

For those who are unable to resolve with above method

  1. Go to project settings in Xcode. Menu File->Project Settings

  2. Go to per-User Project Settings section.

  3. Click on advanced.

  4. Select Xcode Default option. previously this used to be Legacy for my project.

I have analysed on similar lines and concluded that clean is causing the archive to fail. So, the new build system is not clearing the custom/legacy build directory.

delete the build/ folder in ios/ and rerun if that doesn't do any change then
File -> Project Settings (or WorkSpace Settings) -> Build System -> Legacy Build System
Rerun and voilà!

If it still Fails you need to clean full project

Do the following:

  • Delete ios dir manually
  • Clean cache Run npm cache clean --force
  • Run react-native eject
  • Re-install all packages npm install
  • Run the link command react-native link
  • Finally run react-native run-ios
Oxbridge answered 19/3, 2019 at 7:53 Comment(14)
and what if you are on mid '11 imac and cannot update your Xcode anymore?Jitterbug
You need to check your react-native version whether it stable to work with xcode version @AngelOxbridge
@Jitterbug OS X El Capitan 10.11.6 is the last supported release of macOS for your model of iMac. The latest release of Xcode that can be installed on your machine is Xcode 8.2.1 with macOS 10.12.2 SDK and iOS 10.2 SDK. So update ur imacOxbridge
Is up to date, I solve the issue and also post the answer. Going to keep looking with the community is working on a permanent fixHerniotomy
@Akshay Mulgavkar, the iMac is fully updated but still the error persist. on the 25/03 new xcode came out and my iMac isn't eligible for this update.Jitterbug
Same problem. '13 iMac and XCode updated to 10.2, but the error persists.Verecund
circleci.com/blog/… also follow this whoever has this issueOxbridge
React Native 0.61.5. No one of these solutions worked.Tadio
Thank you! Updating the Xcode worked for me. (iPhone running 14.3, but I had to update the Xcode for 14.4, that I kept pending)Receivable
Please clarify; why do I need to always use latest Mac software to get things working ? I could run Android build without any issue on Android emulator even from 3 year old Mac OS and Android Studio as well.Koodoo
some things work and have no valid explanations.Oxbridge
@AkshayMulgavkar Yes! But I'm not complaining ;)Caduceus
There is no react-native eject!!!Goddamned
How do you get the /ios folder back if you delete it.Gethsemane
G
30

cd ios && rm Podfile.lock && pod install worked for me.

And perhaps few updates if the first didn't help as much, as:

sudo gem install cocoapods
rm Podfile.lock && pod install --repo-update
Garnish answered 3/6, 2020 at 17:53 Comment(2)
Thanks! This worked for me because I deleted the ios directory and checked it back out from git.Foxhole
You have to remove Podfile.lock to work the command pod install --repo-update rm Podfile.lock && pod install --repo-updateRew
U
17

After upgrading react-native, you may have stale dependencies. The steps below should fix it.

  1. cd ios
  2. delete Podfile.lock
  3. pod deintegrate && pod install
  4. Navigate back to package.json directory
  5. run react-native run-ios
  6. In Xcode you can build your project again too

I did this after upgrading to react-native 0.61

Underglaze answered 7/3, 2020 at 18:43 Comment(2)
I keep coming back to this answer. It's been probably my most consistently working fix to various issues I seem to have sometimes. THANK YOUSkid
This post is what solved it for me. Thank you very much!Introrse
A
13

For me it caused by installing react-native-vector-icons and linking by running the react-native link react-native-vector-icons command.

I just unlinked the react-native-vector-icons by following commands

  1. react-native unlink react-native-vector-icons
  2. cd ios
  3. pod install
  4. cd ..
  5. react-native run-ios

As I already installed an other icon library.

Amphiprostyle answered 20/5, 2020 at 21:53 Comment(4)
I had to do npx react-native unlink react-native vector-iconsIllstarred
This was it for me. I had installed vector-icons for adhoc usage. Part of that installation process was to link react-native-vector-icons ... a while later, I wanted to use the react native elements. When I installed native elements and attempted to build the project, the stack trace included information about unlinking vector icons for react native elements to auto build and link it properly.Selfrising
thanx bro !!! i had exactly same issue with you and i solvedFigurative
I had the same issue and just had to uninstall react-native-vector-icons and it ran without an issueInterlocutor
B
9

Should always start with the simplest first, after wasting hours and days on this error.

And after an extensive amount of research,

Simply

RESTART YOUR MACHINE

This resolved this error.

I'm on

react-native-cli: 2.0.1
react-native: 0.63.3
Bliss answered 24/11, 2020 at 15:49 Comment(3)
worked for me, thank you for saving my time... and project!!!Relume
I haven't restarted my computer since installing xcode about a week ago - this solution worked for meGottlieb
This simply RESTART YOUR MACHINE save my life !!Socinian
B
8

This problem may occur after installing react-native-vector-icons

  1. Open the project in Xcode.
  2. Go to build phases.
  3. go to Copy Build resources.
  4. Remove all .ttf files from here.
  5. Run the application. enter image description here
Boer answered 12/1, 2022 at 15:10 Comment(4)
You absolute legend, you just saved me potentially hours of time. Thank you!!!Gethsemane
@kunalNayek it's work for me tnksMasaccio
superb! worked for meKreiner
never thought this would work for me. Thank you! this answer needs more votes :)Fibster
I
7

If you don't have cocoa pods installed you need to:

sudo gem install cocoapods

Then run:

cd /ios
pod install

delete the build folder in ios folder of your react native project

run:

react-native run-ios

if error persists:

  • delete build folder again
  • open the /ios folder in Xcode
  • navigate File -> Project Settings -> Build System -> change (Shared workspace settings and Per-User workspace settings): Build System -> Legacy Build System
Intendant answered 25/9, 2019 at 6:37 Comment(0)
D
6

I had the same error, but it was caused by the package manager process port being already used (port 8081).

To fix, I just ran the react-native by specifying a different port, see below.

react-native run-ios --port 8090

Doretha answered 6/6, 2019 at 2:18 Comment(0)
W
5

A popular reason to builds failing and error code 65 is a missmatch between cached pod files and current packages used. Here is how to remove the cache and recreate the pods.

1. Delete Derivate Data - Remove data that includes cached info of the project Example how to do it: https://www.youtube.com/watch?v=f8bTvx0Aoyo

2. Delete .xcworkspace file from ios folder - This is the Xcode project file that gets created when you run pod install we want to recreate it in step 4. This project file uses pods and has a white coloured icon instead of the blue coloured base project without pods.

3. Delete Podfile.lock - Remove old dependencies info so we can recreate them in the next step.

Do a pod-install in ios folder or npx pod-install in root with (React native) - Here we download the pod dependencies again and the pod files only the ones that are used from the current packages are downloaded. A .xcworkspace is regenerated

Wilke answered 16/8, 2021 at 16:23 Comment(2)
Thank you. Worked for meYonder
My project was initiated from Linux to Mac M1; this worked for me.Bevus
P
3

In my case, the issue was with my Xcode build scheme. When you run react-native run-ios you may see something like,

  • info Found Xcode workspace "myproject.xcworkspace"*

  • info Building (using "xcodebuild -workspace myproject.xcworkspace -configuration Debug -scheme myproject -destination id=xxxxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxx -derivedDataPath build/myproject")*


In this case, there should be a scheme named myproject in your ios configurations. The way I fixed it is,

Double clicked on myproject.xcworkspace in ios directory (to open workspace with Xcode)

Navigate into Product > Scheme > Manage Schemes...

Created a Scheme appropriately with name myproject (this name is case-sensitive)

Ran react-native run-ios in project directory

Paginate answered 13/10, 2020 at 9:5 Comment(0)
H
3

In case you are using a Mac M1 architecture it is not directly compatible with Cocoapods. If you encounter issues when installing pods, you can solve it by running:

  • sudo arch -x86_64 gem install ffi
  • arch -x86_64 pod install

These commands install the ffi package, to load dynamically-linked libraries and let you run the pod install properly, and runs pod install with the proper architecture.

Source: https://reactnative.dev/docs/environment-setup see "Note for Mac M1 users"

Hesler answered 28/8, 2022 at 11:21 Comment(0)
N
1

run pod install inside ios folder then go back to root folder and run npx react-native run-ios

Nathanielnathanil answered 16/3, 2020 at 11:33 Comment(0)
D
1

What worked for me was to rename the project by removing the special characters.

Example: "project_marketplace" to "projectmarketplace"

In this case, I redid the project with react-native init and copied the src and package.json folder.

Disherison answered 3/4, 2020 at 12:5 Comment(0)
C
1

Some changes in Podfile haven't been updated. Maybe one of your native dependencies has changed.

  1. expo prebuild --clean
  2. cd ios
  3. pod install
  4. yarn iOS

Had the same problem again with the error No such module 'ExpoModulesCore', and the above solution didn't work. This time this code in Podfile saved me:

installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end

found it here https://github.com/expo/expo/issues/17511#issuecomment-1128657487

Candlepin answered 14/3, 2022 at 9:53 Comment(3)
In my case I did just nee to reinstall my dependencies run yarn && cd ios && pod install thanks.Lorri
It's not strictly true that the AppDelegate.m relies on the Podfile. The podfile specifies the native ios libs to be to be imported for your project. This includes native code that is used by RN Libs that you may be using, and if you are using a hybrid app, native libs that could be used elsewhere in your app. The AppDelegate.m may or may not import these libraries.Lorri
@Lorri - edit is gladly welcome!:)Candlepin
T
1

If you encountered issues with M1.

Try installing the ffi package and running install again.

sudo arch -x86_64 gem install ffi
cd ios
arch -x86_64 pod install

Another solution that I found here works great, basically installing cacoapods with brew (and passing -arm64).

sudo gem uninstall cocoapods
arch -arm64 brew install cocoapods
cd ios
pod install
Timisoara answered 18/4, 2022 at 21:23 Comment(0)
W
1

If you've built/run your app previous from Xcode and want to go back to using the terminal you need to clean your build folder. Go to product -> Clean Build Folder

Wakerife answered 21/4, 2022 at 18:0 Comment(0)
C
1

Earlier the folder name was like :-

React Native Projects


then I change it to

ReactNativeProjects 



doing this my error was gone because the space was causing problem in the path.

As you can see in the image.

enter image description here

Coreycorf answered 4/8, 2023 at 8:44 Comment(1)
yeah, that can be, that can be, also the parent folders too.Liquesce
I
0

This could also be due to having custom named schemes, in that case:

  • cd ios
  • xcodebuild -list

Find your's, it might have a -dev suffix. Then:

  • cd .. (root of the app)
  • npx react-native run-ios --scheme custom-scheme-name
Involucrum answered 5/2, 2021 at 10:33 Comment(0)
W
0

In my case everything solved after re-cloning the repo and launching it again.

Setup: Xcode 12.4 Mac M1

Wilke answered 15/2, 2021 at 18:44 Comment(0)
P
0

In my case, none of the answers resolved it, since am not able to open .xcworkspace at all. But the legacy comment hinted to a RN to Xcode <> compatibility issue, so i tried all the previous RN Versions and all below [email protected] seem to work with xcode 11.3.1 npx react-native init projectName --version 0.62.0

Thanks

Photoplay answered 2/5, 2021 at 16:39 Comment(0)
M
0

Below work for me though I encounter error code 65 due to I rename an existing project name to a new name which I did for all the files within the project. My solution was :-

  1. At ios folder level open xworkspace with xcode.
  2. Click on file tab then click on workspace settings.
  3. I clicked on advance then I select xcode default then I clicked on close button.
  4. I clicked on scheme tab which is beside the stop button at the right then I clicked on edit scheme.
  5. When the edit scheme opened I clicked on build tab then I click on manage scheme button.
  6. I selected scheme of my project name then I clicked the minus(-) button to delete it then I clicked on close
  7. I clicked on clean build folder then when its complete I clicked on build tab to rebuild the project.
  8. I clicked on play button which i selected the simulator I want then everything work perfectly again.
Mastoid answered 17/5, 2021 at 9:43 Comment(0)
I
0

I too had an issue with react-native-vector-icons causing this. I still wanted to use the icons though, and I was using VSCode

Workaround was to more or less the same as the manual instructions from the docs but a little different.

  1. npm install --save react-native-vector-icons

  2. copy the .tff files you want to use in node_modules -> react-native-vector-icons -> fonts

  3. create a new folder "fonts" in src -> ios ...paste the .tff files in there

  4. open 'info.plist' in src -> ios -> mobile

  5. on the line above </dict> paste:

<array>
    <string>AntDesign.ttf</string>
    <string>Entypo.ttf</string>
    <string>EvilIcons.ttf</string>
    <string>Feather.ttf</string>
    <string>FontAwesome.ttf</string>
    <string>FontAwesome5_Brands.ttf</string>
    <string>FontAwesome5_Regular.ttf</string>
    <string>FontAwesome5_Solid.ttf</string>
    <string>Foundation.ttf</string>
    <string>Ionicons.ttf</string>
    <string>MaterialIcons.ttf</string>
    <string>MaterialCommunityIcons.ttf</string>
    <string>SimpleLineIcons.ttf</string>
    <string>Octicons.ttf</string>
    <string>Zocial.ttf</string>
    <string>Fontisto.ttf</string>
  </array>

...or whatever fonts you selected.

I ran react-native run-ios and it worked like a charm.

Insured answered 5/8, 2021 at 11:56 Comment(0)
T
0

In a React Native app, I removed some font assets that I previously linked. For some reason, they didn't get deleted from the Xcode project. I deleted them manually and then it worked.

Tonsillitis answered 2/1, 2022 at 10:16 Comment(0)
S
0

For our project, we had to run the npx react-native link command in order to get the react native vector icons to show up on Android phones. But that added code to the ios/yourprojectname.xcodeproj/project.pbxproj file. And that caused the build to fail, throwing an error code 65 and listing out all the fonts that were duplicated.

So, to fix the error, we just removed all of the new code that was added by the npx react-native link command.

Sememe answered 9/4, 2022 at 19:12 Comment(0)
S
0

In my case it was an issue between different installations of npm installed via nvm and homebrew which somehow messed up my setup.

Building via Xcode usually works without solving the initial problem. I have solved it as follows. Notice, that this guide is suitable if you want to use nvm.

First, we remove a possible installation of npm and yarn using brew as follows.

brew uninstall npm
brew uninstall yarn

We might want to remove nvm as well.

rm -rf "$NVM_DIR"

Next, we reinstall nvm by executing the following command.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | <ShellOfYourCoice>

Replace <ShellOfYourCoice> with bash if you are using bash, with zsh if you are using zsh.

Add the following content to ~/.bash_profile (.bashrc) for bash or to ~/.zshrc for zsh (you might need to create these files).

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

For zsh, we might need to fix some permissions. Execute the following command.

compaudit | xargs chmod g-w

Then, source the shell of your choice. Verify the installation by executing the following.

nvm --version
which npm

The last command should print something similar to the following.

/Users/<userName>/.nvm/versions/node/v16.10.0/bin/npm

If yarn were installed using npm previously, we first remove it.

npm uninstall yarn

Next, we reinstall it.

npm i -g yarn

These steps fixed the issue for me.

Saul answered 31/5, 2022 at 10:49 Comment(0)
D
0

For macOS, make sure that none of the names of the directories has a space character ' ' in their names. I spent hours figuring out the problem and the problem was so small.

Dail answered 6/6, 2022 at 8:30 Comment(0)
L
0

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65 That was my error and i resolve this error with the following commands:-

1- Uninstall Ruby with: brew uninstall ruby --force

2-Uninstall CocoaPods. At first, try to list all CocoaPods versions / components with gem list --local | grep cocoapods. Then uninstall them one by one, in my case:

1- sudo gem uninstall cocoapods

2- sudo gem uninstall cocoapods-core

3- sudo gem uninstall cocoapods-downloader ,cocoapods-plugins ,cocoapods-search ,cocoapods-trunk ,cocoapods-try

etc.

3- As a next step I was able to reinstall ffi and then CocoaPods with: i) sudo arch -x86_64 gem install ffi ii) sudo arch -x86_64 gem install cocoapods

Once done, I could run pod install as expected. Note that I had the Terminal open all the time in standard mode - no Rosetta required.

Lions answered 2/8, 2022 at 14:4 Comment(0)
F
0

If you're like me and tried to change the name of the TestApp-folder. Notice the last line in the warning:

xcodebuild: error: The workspace named "TestApp2" does not contain a scheme named "TestApp-tvOS". The "-list" option can be used to find the names of the schemes in the workspace.

Not changing the TestApp name in the command nor after from this, helped me get rid of the message and the app was built:

react-native init TestApp --version=react-native@npm:react-native-tvos@latest
Fro answered 4/8, 2022 at 12:28 Comment(0)
M
0

UPDATE:

If you are experiencing this in 2023 because you updated your Xcode to version 15, simply upgrade your react native to version 0.71.11 and above.

See more info here. Same goes for expo projects (see here).

If you don't want to upgrade your react native version, there is a workaround described here.

Cheers 🥂

Misdeed answered 23/9, 2023 at 8:18 Comment(0)
R
0

For me this error showed up after upgrading React Native from 0.69 to 0.72.

Suprisingly all that was needed was to:

Remove all the derived data and rebuild:

rm -rf ~/Library/Developer/Xcode/DerivedData && npx react-native run-ios

If still doesn't work then

1. Make sure metro server is stopped and run a full cache clean:

watchman watch-del-all && rm -rf ios/build && rm -rf ~/Library/Developer/Xcode/DerivedData && rm -rf node_modules && yarn install && cd ios && rm -rf Pods && pod install && cd .. && npx react-native run-ios

Note: if pod install fails take a deep looks at the pod errors

2. Attempt to build with Xcode and look deep into any errors triggered at Xcode build process

Rhaetia answered 14/2 at 10:25 Comment(0)
C
-1

there was some issue while creating the app so in my case i just deleted the package-lock.json and did npm i

after that

cd ios/ and pod install

Chthonian answered 27/6, 2021 at 17:25 Comment(1)
deleting package-lock or yarn.lock is not recommended. Mere rm-rf node_modules then npm i or yarn might be enoughActinotherapy
H
-4

Here is the a possible solution

The problem is found in RealmReact.xcodeproj

Herniotomy answered 1/4, 2019 at 4:6 Comment(2)
Share the answer here, not a linkOverwrite
This problem is solved by selecting "Team name" From "signing & capabilities" in XCODE. Try this onceBrandes

© 2022 - 2024 — McMap. All rights reserved.