React Native iOS build fail unable to resolve build file - ios

I have a react-native app I am creating, in which I am following a tutorial, and this app will not build any more. Since I added Redux (and I did this the day after the app was working perfectly), the app has been all over the place. I reverted code, I re-installed node modules. I even created a new project and brought over the code and ran npm install and yet nothing still will work. I even cleared build files via xcode and that didn't really help either.
The error I am getting is:
info Found Xcode project "rncourse_new.xcodeproj"
info Building (using "xcodebuild -project rncourse_new.xcodeproj -configuration Debug -scheme rncourse_new -destination id=E9C3D218-C3D5-4D9F-8931-0900B1C
DD86B -derivedDataPath build/rncourse_new")
.........
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 w
ith Xcode.app, by opening rncourse_new.xcodeproj. Run CLI with --verbose flag for more details.
User defaults from command line:
IDEDerivedDataPathOverride = /Users/myusername/Desktop/SE_Things/Udemy/react-native/rncourse_new/ios/build/rncourse_new
note: Using new build system
note: Planning build
note: Constructing build description
Build system information
error: Unable to resolve build file: XCBCore.BuildFile (missingTargetProductReference("3b72bb1ebc7660513872fe9a221d33fb29fe2a87b7c65fea7a8f025b04a3b7ff"))
(in target 'rncourse_new')
** BUILD FAILED **
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rn-course#0.1.0 ios: `react-native run-ios`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rn-course#0.1.0 ios script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/myusername/.npm/_logs/2019-08-07T23_37_29_541Z-debug.log
Not sure where else to go with this, I even asked the owner of the tutorial and I am waiting for him to get back to me again (he originally told me to re-create the project and bring over his code which I did, and it didn't work).
Here is the link to my github repo:
https://github.com/ThatDevOpNeal/react-native
All that needs to be done is an npm install (do not run npm audit fix) and npm run ios or react-native run-ios.

I just got this error message, and I try to delete ios/build directory and rebuild, but it still has error, so i have to create a new project, copy my old code. and it works.
I think when I delete node_modules, CocoaPods module not install. It is the absence of this package that causes this.
by the way, I am a Chinese, my english is not very will. Hope understanding.

Related

Building Atom text editor on Windows fails

I assume we can build Atom on Windows
I followed "Hacking on Atom Core" https://flight-manual.atom.io/hacking-atom/sections/hacking-on-atom-core/#platform-windows
but when I tried to build release 1.59 it failed.
npm ERR! C:\Users\admin\AppData\Local\node-gyp\Cache\15.9.0\include\node\v8.h(28,10): fatal error C1083: Cannot open include file: 'cppgc/common.h': No such file or directory [.\atom_git\atom-1.59-releases\script\node_modules\fs-admin\build\fs_admin.vcxproj]
npm fails to download and install modules.
...
npm WARN old lockfile about: No matching version found for about#1.9.1.
...
I'll really appreciate if somebody can give a reference to Atom build manual.
Thanks.
I had found that build fails when I follow the instructions.
But it builds if I use apm to load modules and build it.

OS\Cordova Permissions Error > "Error: EACCES: permission denied, scandir"

When I run 'cordova build ios' on an existing project I get a permissions error when accessing the projects ios folder.
Node has been installed using 'NVM' and when I run 'which cordova' and it gives me the correct path in the .nvm folder.
I'm also able to install npm packages without sudo and can run 'cordova build ios' on on other projects no problem.
Error printed in the terminal:
cordova-custom-config: Skipping auto-restore of config file backup(s)
Error: EACCES: permission denied, scandir '/Users/username/project/cordova/platforms/ios/build/device/libCordova.a'
The last resort I can think is removing the ios platform and adding again, but the last dev may have made some changes to these files so would like to avoid that if possible.
I got the same error but for many other files, all when running 'cordova build ios'. The files in question were all in the same folder, all owned by 'root'. I am pretty sure that I had previously and mistakenly run 'sudo cordova build ios', which would have generated the files initially.
I ran a 'sudo chown -R [me] [folder]' and got my build back.

How to fix Failed to fetch platform cordova-ios#~4.4.0

When I use the "cordova platform add ios" command for the latest Cordova version which is 7.0.1, I receive a failed to fetch message.
I am trying to upgrade an existing project to iOS version 4.4.0 but for my peace of mind, I tried creating a fresh project which also had the same error.
Here is my terminal output below showing the errors I receive, can anyone recommend a solution to resolve this issue?
Stuarts-MacBook-Pro:T Stu$ cordova create myApp org.apache.cordova.myApp myApp
Creating a new cordova project.
Stuarts-MacBook-Pro:T Stu$ cd myApp
Stuarts-MacBook-Pro:myApp Stu$ cordova platform add ios
Using cordova-fetch for cordova-ios#~4.4.0
Error: Failed to fetch platform cordova-ios#~4.4.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Failed to get absolute path to installed module
Stuarts-MacBook-Pro:myApp Stu$ cordova platform add ios
Using cordova-fetch for cordova-ios#^4.4.0
Error: Failed to fetch platform cordova-ios#^4.4.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 254 Error output:
npm WARN org.apache.cordova.myapp#1.0.0 No repository field.
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/Cellar/node/6.2.0/bin/node" "/usr/local/bin/npm" "install" "cordova-ios#^4.4.0" "--save"
npm ERR! node v6.2.0
npm ERR! npm v3.8.9
npm ERR! path /Users/S/Development/T/myApp/node_modules/.staging/xml-escape-d330e1e1
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/S/Development/T/myApp/node_modules/.staging/xml-escape-d330e1e1' -> '/Users/S/Development/T/myApp/node_modules/cordova-ios/node_modules/xml-escape'
I have resolved this, it appears to be an NPM issue and not a Cordova one. I just updated NPM within Terminal and after the update "cordova platform add ios" worked fine. Happy days - 1 !
npm update -g
Delete the folder cordova-ios, located in node_modules/cordova-ios.
Type the following command
ionic cordova build ios
Sometimes a previously added Platform is not removed Properly, so this type of issue occurs. Remove the platform by command and add it again..
Follow this steps:
Run the command
ionic cordova platform remove ios
Run the command:
ionic cordova platform add ios --save
If you are still getting the issue, try running again:
ionic cordova platform remove ios --save
NOTE: By running again the command ionic cordova platform remove ios --save fetches newer version of ios platform.
For example:
First time: cordova-fetch for cordova-ios#~4.5.1
Second time: cordova-fetch for cordova-ios#~4.5.4

cant run ios simulator on cordova

On running the command
cordova emulate ios
I get an error, as below. I actually get rm: could not remove & permission denied errors so I use sudo. I was able to run this no problem, and then after a reboot - although nothing was changed - this function does not work. After build succeeded - deploying to emulator I get this error
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT: no such file or directory, stat '/Users/user/Library/Logs/CoreSimulator/8F3C9A0F-D432-49A4-84DA-D0480829884A/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/user/helloworld/platforms/ios/build/emulator/helloworld.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-4s,--stderr,/Users/user/helloworld/platforms/ios/cordova/console.log,--stdout,/Users/user/helloworld/platforms/ios/cordova/console.log,--exit
Error: /Users/user/helloworld/platforms/ios/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
I have reinstalled sudo npm install ios-sim -g and same error. How can I run it properly?
This happens due to the permissions on mac:
Here are the steps you can use to correct this issue:
Empty the 'platforms' folder in your Cordova project.
Re-run Cordova platform add ios, Cordova build ios, and Cordova emulate ios without sudo.
If you are on a Mac and are still getting a permissions error, make sure all the files in your user's home folder actually belong to that user by running sudo chown -R username /Users/username
Its happening when you don't have simulator configurations for the root user.
Following command worked for me
sudo npm install -g ios-sim
If it's not working you can try removing platforms as the root user and add it back as normal user.
This happens because xcode command line tools are not installed in your system
https://github.com/driftyco/ionic/issues/4657.
Do a xcode-select --install from your terminal and reboot the system should work fine.

The following build commands failed

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.

Resources