facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
117.71k stars 24.16k forks source link

Unable to run AwesomeProject sample app successfully with error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. #24450

Closed jerrychong25 closed 5 years ago

jerrychong25 commented 5 years ago

🐛 Bug Report

To Reproduce

1) Open Getting Started for macOS iOS. 2) Follow all dependencies installation steps 3) Create a new application via command: react-native init AwesomeProject 4) Run AwesomeProject via command:

cd AwesomeProject
react-native run-ios

5) Error occured when running project:

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your a
pp with Xcode.app, by opening AwesomeProject.xcodeproj

6) Run sample app failed.

Expected Behavior

Run sample app successfully.

Code Example

Run new project named AwesomeProject as mentioned in Getting Started for macOS iOS.

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
      Memory: 190.08 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.14.0 - /usr/local/bin/node
      npm: 6.7.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 27, 28
        Build Tools: 27.0.3, 28.0.3
        System Images: android-23 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, andr
oid-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.2/10E125 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.4 => 0.59.4 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Debug Log

macusers-MacBook:AwesomeProject HighSierra$ react-native run-ios
info Found Xcode project AwesomeProject.xcodeproj
info Launching iPhone X (iOS 12.2)...
info Building using "xcodebuild -project AwesomeProject.xcodeproj -configuration Debug -scheme AwesomeProject -destination id=274D552C-C67B-4EFA-A90C-
AF559D0954F0 -derivedDataPath build/AwesomeProject"
info User defaults from command line:

info     IDEDerivedDataPathOverride = /Users/HighSierra/Documents/GitHub/AwesomeProject/ios/build/AwesomeProject

info Build Preparation

info Couldn't create workspace arena folder '/Users/HighSierra/Documents/GitHub/AwesomeProject/ios/build/AwesomeProject': Unable to write to info file
 '<DVTFilePath:0x7f9358f7b8d0:'/Users/HighSierra/Documents/GitHub/AwesomeProject/ios/build/AwesomeProject/info.plist'>'.

info 

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your a
pp with Xcode.app, by opening AwesomeProject.xcodeproj

2019-04-15 11:50:32.423 xcodebuild[30913:229065] Error saving log: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied" UserInfo={NSFilePath=/U
sers/HighSierra/Documents/GitHub/AwesomeProject/ios/build/AwesomeProject/Logs/Build/09631BCB-251C-4C0A-8A81-7451C031D0B5.xcactivitylog, NSLocalizedDes
cription=Permission denied} | User info: {
    NSFilePath = "/Users/HighSierra/Documents/GitHub/AwesomeProject/ios/build/AwesomeProject/Logs/Build/09631BCB-251C-4C0A-8A81-7451C031D0B5.xcactivit
ylog";
    NSLocalizedDescription = "Permission denied";
}
** BUILD FAILED **

. Run CLI with --verbose flag for more details.

Could anyone assist on this issue?

Thanks.

kamilzamerski commented 5 years ago

The same after update xcode ... Solution for me was to delete 2 "gray" elements problem from Libraries and rebuild project.

saxenanickk commented 5 years ago

@jerrychong25 Hey! I can provide a temporary workaround for your problem. Follow these steps:

File -> Workspace Settings -> Build System -> Legacy Build System

alvin-toffler commented 5 years ago

The same after update xcode ... Solution for me was to delete 2 "gray" elements problem from Libraries and rebuild project.

@kamilzamerski Can you elaborate?

kamilzamerski commented 5 years ago

@alvin-toffler After update XCode i've got that problem with build project. I've discovered that in XCode project in Libraries directory i have 2 bad linked libs (gray icon against blue and without posibility to extend arrow). I deleted it from the project and once again do a react-native link. And now it's work properly.

Zrzut ekranu 2019-04-17 o 11 02 06

nolan12345 commented 5 years ago

File -> Shared Project Settings -> Build System -> Legacy Build System

Piero87 commented 5 years ago

Yesterday react-native run-ios works with no problem and today I get the error of this issue and haven't change or update anything, any solution?

carlosbonilla commented 5 years ago

@Piero87 I had exactly the same problem, I just delete the build folder inside /ios then just run again react-native run-ios and the error disappear.

niclin commented 5 years ago

I just try sudo react-native run-ios the error disappear.

HughBerryman commented 5 years ago

I was getting this same error with regards to the Info.plist. None of the above worked for me - what did was removing <key>NSAllowsArbitraryLoads</key> in Info.plist which was git diffed and added in RN 0.59.8 when I did the manual upgrade. Once I removed that line, everything complied and I was good to go.

wannyphy commented 5 years ago

I found a solution if someone has a problem and you have to create a new folder in document on the command line and it works the reason remains a mystery but after a while I tried everything well that one logically if not at the end of the chips I would never have tested it...

levelingup commented 5 years ago

@Piero87 I had exactly the same problem, I just delete the build folder inside /ios then just run again react-native run-ios and the error disappear.

This should be the answer

titoleru commented 5 years ago

@Piero87 I had exactly the same problem, I just delete the build folder inside /ios then just run again react-native run-ios and the error disappear.

I tried this and it worked... Thanks!

raphaelpinel commented 5 years ago

@Piero87 I had exactly the same problem, I just delete the build folder inside /ios then just run again react-native run-ios and the error disappear.

This should be the answer

This was the answer for me too!

hramos commented 5 years ago

The original author hasn't commented recently, and the template is already tested as part of our CI system, so this shouldn't be a problem on master right now. If anyone runs into a similar problem, please submit a new issue.

akashrauniyar35 commented 5 years ago

in my case 'react-native run-ios' works :)

Why you came here then?

jerrychong25 commented 5 years ago

The original author hasn't commented recently, and the template is already tested as part of our CI system, so this shouldn't be a problem on master right now. If anyone runs into a similar problem, please submit a new issue.

Noted and thanks.

joelwembo commented 5 years ago

I deleted the build folder inside the ios and run the react-native run-ios, It Worked

BobsonTheFirst commented 5 years ago

This error occurred when I opened my project for the first time in XCode cuz i needed to add a library. Deleting the build folder in the ios folder alone didn't work for me.

What worked for me:

eugeneFr9 commented 5 years ago

None of mentioned above has worked for me. I just created new project and can not run it...

veller commented 5 years ago

None of these is working for me either. Why is this even closed?

vatsalyaagarwal commented 5 years ago

None of these is working for me either. Why is this even closed?

downgrade to react-native@0.59.5, only thing that worked for me.

ilyasKerbal commented 5 years ago

Same issue error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening TestProject.xcworkspace. Run CLI with --verbose flag for more details. User defaults from command line: IDEDerivedDataPathOverride

claudiolcastro commented 5 years ago

Same issue here.

react-native-cli: 2.0.1 react-native: 0.60.0 xcode: 10.2.1

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening MyApp.xcworkspace. Run CLI with --verbose flag for more details

claudiolcastro commented 5 years ago

so far... with those configs above, the only thing that worked for me was creating a new projet with react-native version 0.59.5 (and reset cache react-native start --reset-cache)

react-native init MyApp --version 0.59.5

zexingguo commented 5 years ago

^ Same issue!

haytv94 commented 5 years ago

@Piero87 I had exactly the same problem, I just delete the build folder inside /ios then just run again react-native run-ios and the error disappear.

It work for me. Thank you very much!

sbvijay commented 5 years ago

Same issue error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening TestProject.xcworkspace. Run CLI with --verbose flag for more details. User defaults from command line: IDEDerivedDataPathOverride

haytv94 commented 5 years ago

Same issue error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening TestProject.xcworkspace. Run CLI with --verbose flag for more details. User defaults from command line: IDEDerivedDataPathOverride

Please read the solution above again carefully.

NandoSantana commented 5 years ago

Same issue error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening TestProject.xcworkspace. Run CLI with --verbose flag for more details. User defaults from command line: IDEDerivedDataPathOverride

Same to me too.

dezudas commented 5 years ago

non of above works for me :(

ebongso commented 5 years ago

so far... with those configs above, the only thing that worked for me was creating a new projet with react-native version 0.59.5 (and reset cache react-native start --reset-cache)

react-native init MyApp --version 0.59.5

I am on react-native 0.60.4. The project didn't run at first. So, had to downgrade to react-native 0.59.5 per the suggestion. Now, the project runs when I execute react-native run-ios.

ar2zee commented 5 years ago

Not sure that I can help someone, but I got exactly the same error and the problem was with pods or better to say with lack of pods so I went to /ios and run pods installand it resolve my issue.

nanadjei commented 5 years ago

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

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

if 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
AmmiWang commented 5 years ago

I have equally problem, if your has good idea, please @Me.

rizaldirnm commented 5 years ago
  1. cd /ios
  2. run pod install
  3. cd ..
  4. delete build folder
  5. run react-native run-ios

if 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

I hope it will work, install pods ongoing

nanadjei commented 5 years ago

I have equally problem, if your has good idea, please @me.

Have you tried the above instructions?

rizaldirnm commented 5 years ago
  1. cd /ios
  2. run pod install
  3. cd ..
  4. delete build folder
  5. run react-native run-ios

if 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

I hope it will work, install pods ongoing

yes!! it works. Your cocoapods not installed, maybe its the problem. I follow this instruction and run well. thanks!!

clydeautin commented 5 years ago

I've tried all the above and still, nothing works. Everything was fine until I updated my OS earlier today (30 min update).

Update: I delted the AwesomeProject file and intialized a new one and the build was succesful, however, now I get a message in the simulator saying "could not connect to development server" Screen Shot 2019-07-31 at 1 48 36 PM

Update #2: deleting the build folder worked, back to seeing the "Welcome to React screen on the iPhone simulator"

AmmiWang commented 5 years ago

My problem was that I forgot to add startup parameters. I used "react-native run-ios --help" to see some options, and finally I use "react-native run-ios -- secheme XXXX" to start my project.

gaozm0509 commented 5 years ago

@Piero87 I had exactly the same problem, I just delete the build folder inside /ios then just run again react-native run-ios and the error disappear.

It worked for me

vsfountain commented 5 years ago

I followed @Rizaldinurm 's instructions. cocoapods was not installed for me. Worked just fine after that.

Gregory-Canonne commented 5 years ago

if you have this error :

-> remove your folder build in forlder ios -> rm -rf node_modules -> yarn install -> react-native run-ios

enjoys !

NivediB commented 5 years ago

Tried this and it worked... create native react project using this react-native init MyApp --version 0.59. Build the app with Xcode.app

quangduz commented 5 years ago

so far... with those configs above, the only thing that worked for me was creating a new projet with react-native version 0.59.5 (and reset cache react-native start --reset-cache)

react-native init MyApp --version 0.59.5

always works :))

burkek commented 4 years ago

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

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

if 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

Yes! This worked a charm, Cocoapods wasn't installed correctly react-native-cli: 2.0.1 react-native: 0.60.5 Xcode: 10.1

ruihuasui commented 4 years ago

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

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

if 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

Thank you SO MUCH @qodehub-nanadjei. It's the only solution works to me!

xgqfrms-GitHub commented 4 years ago

iOS bug

pod install failed

image

image

xgqfrms-GitHub commented 4 years ago

if 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

image

not work at all

image

diazevedo commented 4 years ago

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

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

if 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

I have no words to describe how useful it was.

vgb0332 commented 4 years ago

Not gonna lie. RN should post this on its tutorial section to make sure older version user has to spend hours to find what's been wrong with the settings...Not everyone knows how to use xcode properly. Isn't it the whole purpose of using RN?