The following build commands failed - ios

I hope someone can help me. I'm really crazy, I've tried everything.
A few days ago installed Titanium Studio on my Mac, then install Xcode. I created a "single window Application Project". Without touching anything special puslo RUN> iOS Simulator> iPhone Retina (3.5 inch).
The program begins to build until the prompt type:
[INFO]: Invoking xcodebuild
[ERROR]: ** BUILD FAILED **
[ERROR]: The following build commands failed:
[ERROR]: Ld build / Debug-iphonesimulator / helloworld.app / helloworld Normal i386
[ERROR] (1 failure)
I updated all Xcode and everything related to Titanium.
Is there any solution?
I have read a lot a lot many forums, but I have not found any solution that works. I have cleaned the build folder, and even fails.
Can you think of anything?

Try installing the command line tools for Xcode. Xcode -> Preferences, Downloads.
Also try checking if you have a folder that has the same name as the app itself?

For me this was a caching issue causing the build to fail.
Delete all DerivedData from your Library root folder
rm -rf /Users/<Your Username>/Library/Developer/Xcode/DerivedData/*
Obviously, replace <Your Username> with whatever your username is (if you're not sure, just run the $ whoami command)
We need to clean cache
If you're using npm
watchman watch-del-all; npm start -- --reset-cache;
If you're using yarn
watchman watch-del-all; yarn start --reset-cache;
Re-install pods
cd ios; pod install; cd ..;
This worked for me at the very least.

Related

app works with yarn start but not in simulator

I am using yarn run ios to run a react native project in Xcode simulator. This was working perfectly till two weeks ago but it's not working right now. Now, I get errors like these:
error: /Users/app/ios/Pods/Target Support Files/Pods-Inst/Pods-Inst.debug.xcconfig: unable to open file (in target "Inst" in project "Inst") (in target 'Inst' from project 'Inst')
** BUILD FAILED **
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I had already tried cleaning cache, removing node modules etc etc but nothing works.
error Command failed with exit code 1. when I try to run yarn
If I simply do yarn start, I think it builds successfully since I can see the flower and all on the terminal. However, when I try using the simulator, it doesn't work. How can I fix this?
Go to /ios folder and the run the following command:
pod install && pod update
Then go back to the project folder and run the following command:
rm -rf node_modules && npm install
Next, clean the ios build folder:
rm -rf ios/build
After that, just run as usual:
react-native run-ios

"config.h" file not found in iOS project of React native

In X-Code project of react native, getting error
config.h file not found.
Here is version detail :
react-native-cli: 2.0.1
react-native: 0.51.0
How to solve it?
Close Xcode.
Open Terminal, go to your project's root folder and run:
cd node_modules/react-native/third-party/glog-0.3.4/
Run the configure script:
./configure
Open Xcode and try to run your app.
I had the same issue, using this steps solves for me:
Running into the same issue here after upgrading from 0.44. None of the above solutions or clearing caches did the trick for me. Here's what I did to get things working again:
In the Terminal, navigate to the react-native/third-party/glog folder inside node_modules (for me, this was cd node_modules/react-native/third-party/glog-0.3.4)
Once actively in this folder, run sh ../../scripts/ios-configure-glog.sh
Glog is configured and the required config.h header file is created for Xcode to find
Run your iOS BUILD
Regards!
When project files get messed up for me. I typically follow these steps.
rm -rf node_modules
npm install
react-native upgrade (Only changing affected files, so IOS for you)
react-native link
npm start --reset-cache
(In another terminal)
react-native run-ios
These steps worked for me:
rm -rf ~/.rncache
rm -rf node_modules/
npm install
npm start
You need to change to the legacy build system in Xcode 10 and install third party scripts manually.
1:
File -> Project/Workspace settings
Build System: dropdown -> change to Legacy Build system
2: Follow this to manually install third party scripts for RN:
Clean RN cache
$ rm -rf ~/.rncache
Re-install the deps
$ cd your_project_path
$ rm -rf node_modules/ && npm install
Then install the third-party
$ cd node_modules/react-native/scripts
$ ./ios-install-third-party.sh
Run the commands below if glog installation failed.
$ cd ../third-party/glog-0.3.x
$ ./configure
It works for me, I hope it helps for you.
If above all answers don't work,
Please check that there is no space in any directory name of the full path and not only the project directory name.
While in terminal, it accepts throgh My Disk as My\ Disk but xcode do not recognize that.
If its in My Disk directory, try after moving it to Desktop or any other directory which doesn't have space in their name.
configure: error: unsafe absolute working directory name Issue:
-Open Terminal, go to your project's root folder and run:
cd node_modules/react-native/third-party/glog-0.3.5/
Run the configure script:
./configure
got error: configure: error: unsafe absolute working directory name
try to created app in desktop and from there run ./configure command.
Please note with XCOXE 10, and Mojave MAC OS , I had same issue, ./configure was showing some permission issue, I had set permission "777" to project folder enclosing with inner folders
This is the linking issue in xcode. You just need to re-link the files.
Please follow the below steps:
Open you peoject's root directory then open node-module -> react-native -> React.
Open React.xcodeproj file in xcode.
You will see missing (showing red in color) files under the third-party folder
Just run the React.xcodeproj project.
After completion close this project & open you project file.
Delete Drive data & Clean the project & run.
If after running the project you are getting linking issue then please make sure you have added all the (ios) products () come under the Libraries -> React.xcodeproj -> Products in your Build Phases -> Link Binary With Libraries.
If everyone has tried solving the issue by this
Open Terminal, go to your project's root folder and run:
cd node_modules/react-native/third-party/glog-0.3.4/
Run the configure script:
./configure
But still not got the solution then,
Go to your Xcode and check if there any library is missing. Add that library and then perform this above step.
Although the already mentioned answers are correct but still few guys are struggling, as only configuring the glog doesn't sometimes resolve the error.
Here I have written a detailed solution to the problem.
Solution: config.h file not found mutex.h During Archive.
The steps are the following:
Remove node_modules directory
Clear Cache
Install packages again with Yarn
Install third party
Configure Glog
Make & Make install glog
For all these above steps the I have shared commands in the above mentioned article, so not going to write again. I hope it will solve problem for guys who are still struggling.

Can't build and run react-native project on Mac

Referring this issue, I've the same problem. I've MacOs El Captain on VMware.
Node v. 7.8.0
npm v.4.6.1
react-native-cli 2.0.1
react-native 0.46.4
Xcode v. 8.2.1
I've two issues:
- when trying to init a new react-native project, the packages fetching hangs on getting react-native 0.46.4 package from repo. Other packages were downloaded successfully. So I've execute npm install from Windows and then copied the node_modules folder on Mac.
- when trying to run the project on iOS simulator I recieve the following error:
** BUILD FAILED **
...
In file included from /Users/michelebombardi/Desktop/ReactNativeProjects/caliup/node_modules/react-native/React/../third-party/folly-2016.09.26.00/folly/Bits.h:70:
/Users/michelebombardi/Desktop/ReactNativeProjects/caliup/node_modules/react-native/React/../third-party/folly-2016.09.26.00/folly/detail/BitIteratorDetail.h:21:10: fatal error: 'boost/iterator/iterator_adaptor.hpp' file not found
#include <boost/iterator/iterator_adaptor.hpp>
The following build commands failed:
CompileC /Users/michelebombardi/Desktop/ReactNativeProjects/caliup/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/third-party.build/Objects-normal/x86_64/Conv.o /Users/michelebombardi/Desktop/ReactNativeProjects/caliup/node_modules/react-native/third-party/folly-2016.09.26.00/folly/Conv.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/CaliUp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/CaliUp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist`
I really need to publish my app on the app store before the end of the week.
I've already try all suggested solutions but nothin works.
Could anyone help me?
First try this:
watchman watch-del-all && rm -rf node_modules
If you install node using Homebrew uninstall it and install node from here.(https://nodejs.org/en/)
Now if you used yarn to install node modules:
Try npm install
This error is caused by a failed third party library download in the build step. In your home folder there should be a ~/.rncache directory with a number of compressed C++ libraries. The error occurs when one or more of these files fails to download completely from the github amazon s3 servers. (likely in China)
The problem sticks around because the script in the react-native xcode build doesn't know how to resume the broken download. So you can fix this by deleting your ~/.rncache folder and because these folders are extracted into your modules you should also rm -rf node_modules and reinstall.
More info can be found here and here
May be this will work. Try these steps:
Backup your icons, images etc from ios folder.
Check that app name is set for key "name" in {project-root}\app.json file.
Delete ios/ and android/ directories
Run react-native eject
Replace the icons,images etc you copied earlier
Run react-native link
Launch you app from Xcode using short cut key command+r

React Native ios build failed on react-native run-ios

getting this error
** BUILD FAILED **
The following build commands failed:
CompileC /Users/karthikn/AwesomeProject/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTTabBarItem.o Views/RCTTabBarItem.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Xcode 8.2 still occur same error. Three lines bellow fixed it for me :)
Downgrade react(16.0.0-alpha.12 -> 16.0.0-alpha.6) & react-native(0.45.0 -> 0.44.0)
rm -rf node_modules/react
npm i react#16.0.0-alpha.6 -S
npm i react-native#0.44.0 -S
Then run react-native run-ios
Your build could be failing because of the current node js version installed, or due to your pod files or a number of other reasons.
This error may also be when cloning a react native repository from github.
This solution may work as I was able to recreate this issue(refer to the screen shots):
Solution one:
firstly:
If you have the latest version of node js installed you may have some compatibility issues with some of the dependencies, install the recommended version of Nodejs instead.
after installation, reinstall your dependencies and update your pod files:
npm install
cd ios
pod install
or
pod update
solution two:
this can happen if you haven't installed react native previously on your system and are trying to run a clone react native repository from github.
brew install watchman
sudo gem install cocoapods
then in the rn project clone
cd ios
pod install
Problem:
This is what the error message looks like:
legacy compatibility issues:
Build failed
Solution:
After following the above steps this issue was resolved instantly:
If it's your first project, you may have the same problem than me:
do NOT use space in your project path! 🎉 😄
If your xcode is open, close it
Remove DrivedData
Update your pod files using pod update command
Run npx react-native ios command
its worked for me i hope work for you too
There's a good chance you're running an outdated version of React-Native and your template is no longer compatible.
There are instructions provided on ways to upgrade.
The simplest would be to run react-native upgrade and you'll be prompted with files react-native wants to overwrite. Clicking yes through all the prompts solved this issue for me but if you're concerned about losing any changes, it's recommended to install npm install -g react-native-git-upgrade and merge any conflicts after running react-native-git-upgrade
Try sudo react-native run-ios
This helped me
Check this In Your info.plist Bundle identifier
Or Add this Bundle identifier name as --> com.cmpname.yourapp // change name according
DO NOT use space in project path. It had solved my problem.
Replace Boost C++ Libraries with this one Download Link
/node_modules/react-native/third-party/boost_1_63_0
seems like there is an issue with the react-native version, downgrading the version will resolve the issue. Use the following commands:
rm -rf node_modules/react
npm i react#16.0.0-alpha.6 -S
npm i react-native#0.44.0-alpha.6 -S
react-native run-ios
There are different problems that cause this issue. I'll post here what I did to resolve in my case.
1 - Delete the folder node_modules and the folders of android and ios from project root:
rm -rf node_modules/ ios/ android/
2 - Rebuild the folders:
npm install && react-native upgrade
or (If you have used yarn in the project)
yarn install && react-native upgrade
3 - After that, just run the command again:
react-native run-ios
or
react-native run-android.
I hope it helped =)

React Native Build Commands Failed: PhaseScriptExecution ... (domain=NSPOSIXErrorDomain, code=2)

Environment
Mac OS X Version 10.11.3 (15D21)
Xcode Version 7.2 (7C68)
Simulator Version 9.2 (SimulatorApp-643)
react-native-cli 0.1.10
node v5.5.0
What I did before running the app
npm install -g react-native-cli
react-native init DemoProjectDELETEME
cd ./DemoProjectDELETEME
react-native run-ios
I am new to React Native. When I try to run the default app on iOS simulator I got the following errors. I found a similar issue but it does not solve my problem.
Xcode6 can't run any app in simulator ( Domain = NSPOSIXErrorDomain, Code = 3 )
After restart the machine and simulator the issues still persistent.
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Run\ Script /Users/x/Desktop/DemoProjectDELETEME/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Script-006B79A01A781F38006873D1.sh
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/DemoProjectDELETEME.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/done.js:10
throw err;
^
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DemoProjectDELETEME.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:464:13)
at Object.execFileSync (child_process.js:484:13)
at _runIOS (runIOS.js:77:34)
at runIOS.js:24:5
at tryCallTwo (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:45:5)
at doResolve (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:200:13)
at new Promise (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:66:3)
at Array.runIOS (runIOS.js:23:10)
at Object.run (/Users/x/Desktop/DemoProjectDELETEME/node_modules/react-native/local-cli/cli.js:86:13)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:73:7)
Got the follower error when I am trying to launch the app from Xcode.
sudo npm start in project root solves the issue, but react-native run-ios still BUILD FAILED.
Thanks for your time viewing my question.
Try running react-native upgrade
See Github thread: https://github.com/facebook/react-native/issues/7308#issuecomment-219597774
For me port 8081 was in use :
lsof -n -i4TCP:8081
1.Go to File -> Project settings
2.Click the Advanced button
3.Select "Custom" and select "Relative to Workspace" in the pull down
4.Change "Build/Products" to "build/Build/Products"
5.click done, done
The problem is in the js file that builds and runs your app. Unless your project, scheme, and Product Name are all the same, you'll get errors, especially on simulators.
The good news is that I submitted a pull request that fixes the problem. Please go upvote it so we don't have worry about things breaking when we rename things.
For me I just needed to edit the iOS project build settings
Product Bundle Identifier was not set
You need to set it for both the Project and 2 Targets
Open your react-native project in Xcode
Create a new schema with project name.
the problem will be solved
Adding sudo in front of all commands solves the problem.
sudo react-native init ProjectName
sudo chmod 777 ProjectName
cd ProjectName
sudo react-native run-ios
For me, I needed to upgrade my version of XCode from Yosemite to Sierra.
This can be done via App Store > Updates.
What worked for me was running pod install from the ios directory
Running
npx pod-install
solved the problem for me.
Open Your Xcode project
Run it
You should have 2 errors from RCTSRWebSocket.m
add (void) to the beginning of both line :
SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
become
(void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
Save and Re-run your project with Xcode or terminal. It should work for sure. I have tested all the solution before, this one is the only who worked for me.
Surprisingly, this was the solution for me: Open the file Views/RTCScrollView.m in Xcode and change the variable _refreshControl to refreshControl. All occurrences of _refreshControl were already marked as errors. The new code becomes:
- (void)setRefreshControl:(RCTRefreshControl *)refreshControl
{
if (refreshControl) {
[refreshControl removeFromSuperview];
}
refreshControl = refreshControl;
[self addSubview:refreshControl];
}
I fixed my issue, you can try it if you are in the same condition.
I encountered the same error:
Print: Entry, ":CFBundleIdentifier", Does Not Exist
When I clone an existing react-native project from learning react native.
I initialize (using {react-native init yourProjectName}) a new project with the same name in a different directory
copy every useful *.ios.js file to this new project from the one I clone elsewhere.
This works for me.
Edit the file ,ProjectName/node_modules/react-native/local-cli/runIOS/runIOS.js
Line no 18 : replace the entire line of code with the following :
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
Line no: 146: uncomment '-derivedDataPath', 'build',
after that run the command from the terminal: sudo react-native run-ios
For me, my problem was that Mcafee is running on port 8081, so I run the app on a different port following this answer https://stackoverflow.com/a/50649969/5323419
Basically:
react-native run-ios --port 1234
react-native start --port 1234
I am using React native 0.55+
Try to run
npx pod-install
Also check the permissions. Maybe you should run react-native run-ios with sudo?
For my case:
If your project folder name called like "Example Project"
You must change it to "Example_Project"
Spaces are causen this error.

Resources