React-native iOS build is failed - ios

The react-native iOS build is failed with following error.
GB-MAC-01s-MacBook-Pro:rrtest muruganandham.kuppan$ react-native run-ios
Found Xcode project rrtest.xcodeproj
Building using "xcodebuild -project rrtest.xcodeproj -configuration Debug -scheme rrtest -destination id=E7283C81-5F0D-4732-BF8B-19DB3C904DA2 -derivedDataPath build"
Ignoring unf_ext-0.0.7.5 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.5
▸ Running script 'Start Packager'
** BUILD FAILED **
Installing build/Build/Products/Debug-iphonesimulator/rrtest.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
I have tried few solutions, but no luck.
EDIT: Additional info
I have changed the react native port to 8088 and modified it in project.

How I fixed the issue?
Get the process running in the port 8081
sudo lsof -i :8081
and killed it.
sudo kill -9 336
*336 is the PID (Process ID)

Related

React Project Running perfect on simulator but showing erroe in real device "Command PhaseScriptExecution failed with a nonzero exit code"

+ node /Users/yasir/Desktop/react-working/react-native-pro/example/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev true --reset-cache --bundle-output /Users/yasir/Library/Developer/Xcode/DerivedData/ProExample-cqxdgythbwgbwfhgmvrstmwvqrhv/Build/Products/Debug-iphoneos/main.jsbundle --assets-dest /Users/yasir/Library/Developer/Xcode/DerivedData/ProExample-cqxdgythbwgbwfhgmvrstmwvqrhv/Build/Products/Debug-iphoneos/ProExample.app
warning: the transform cache was reset.
error The resource `/Users/yasir/Desktop/react-working/react-native-pro/example/index.js` was not found.
Error: The resource `/Users/yasir/Desktop/react-working/react-native-pro/example/index.js` was not found.
at /Users/yasir/Desktop/react-working/react-native-pro/example/node_modules/metro/src/IncrementalBundler.js:297:24
at gotStat (node:fs:2703:21)
at FSReqCallback.oncomplete (node:fs:207:21)
info Run CLI with --verbose flag for more details.
Command PhaseScriptExecution failed with a nonzero exit code
React native project is running perfectly in simulator but showing error while running in real device.
I have tried..
Clean build folder
pod disintegration
pod init
but nothing is working in my case.

React native - CFBundleIdentifier does Not Exist

I am trying to run a React native project to iPad from Visual Studio code but I am getting the following error
warn The following packages use deprecated "rnpm" config that will stop working from next release:
- react-native-video: https://npmjs.com/package/react-native-video
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
info Found Xcode workspace "LibApp.xcworkspace"
info Launching iPad Air (4th generation) (iOS 14.4)
info Building (using "xcodebuild -workspace LibAppe.xcworkspace -configuration Debug -scheme LibApp -destination id=EB7F93D3-C4CE-4DED-9E30-D0F155BFF116") .......................................................................................................................................
info Installing "/Users/Siva/Library/Developer/Xcode/DerivedData/LibApp-aulzxshtfadmpwgvkbujhecsczsx/Build/Products/Debug-iphonesimulator/React/LibApp.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
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier /Users/Siva/Library/Developer/Xcode/DerivedData/LibApp-aulzxshtfadmpwgvkbujhecsczsx/Build/Products/Debug-iphonesimulator/React/LibApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
. Run CLI with --verbose flag for more details.
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier /Users/Siva/Library/Developer/Xcode/DerivedData/LibApp-aulzxshtfadmpwgvkbujhecsczsx/Build/Products/Debug-iphonesimulator/React/LibApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (node:child_process:826:11)
at Object.execFileSync (node:child_process:864:15)
at runOnSimulator (/Users/Siva/Desktop/LibApp/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:183:45)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Command.handleAction (/Users/Siva/Desktop/LibApp/node_modules/#react-native-community/cli/build/index.js:182:9)
But when I run the same code from Xcode, the app gets launched in Simulator
and I am able to check it.
How to fix this error

When running appium test on a real device it failed with Error: xcodebuild failure: xcodebuild failed with code 65

There are so many related issues but nothing solved my issue.
I can run the simulator without any issue, but when running on a real device I get this error
Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
I have done the manual config already.
My environments are :
appium - Version 1.17.1-beta.0
Xcode - Version 11.3.1 (11C504)
So far I have tried with appium versions:
1.13.0
1.15.0
1.15.1
1.17.0
1.17.0
I was able to build the WebDriverAgent to the device without any issue.
The log
If I run
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test
I get the following result.
Testing failed:
WebDriverAgentRunner:
WebDriverAgentRunner-Runner.app (379) encountered an error (Failed to load the test bundle. (Underlying error: The bundle “WebDriverAgentRunner” couldn’t be loaded because it is damaged or missing necessary resources. The bundle is damaged or missing necessary resources. dlopen_preflight(/var/containers/Bundle/Application/14851F2A-8FB2-4845-9A20-410C9463CEB3/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner): no suitable image found. Did find:
/var/containers/Bundle/Application/14851F2A-8FB2-4845-9A20-410C9463CEB3/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner: code signature invalid for '/var/containers/Bundle/Application/14851F2A-8FB2-4845-9A20-410C9463CEB3/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner'
))

react native ios build succeeds but path to app bundle is wrong

When I run react-native run-ios build succeeds and created build folder under ios. But after build, when installation starts, get the below error. The project runs successfully when I run it through xcode. What I observed is that path beginning 'DerivedData' is wrong. Instead it should be 'build'. When I rename my 'build' folder to 'DerivedData' and re-run 'react-native run-ios' the whole process completes successfully but of course with the previous build.
How can I change the 'DerivedData' to 'build'?
This error occurred immediately after I upgraded from 0.59.9 to 0.60.0.
Error:
info Installing "DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.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
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
. Run CLI with --verbose flag for more details.
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnSimulator (/Users/armaneker/WebstormProjects/mobileappname/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:189:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
React Native version:
System:
OS: macOS 10.15
Binaries:
Node: 10.15.3 - /usr/local/bin/node
npm: 6.13.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.0 => 0.60.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Steps To Reproduce
used rn-diff-purge to upgrade from 0.59.9 to 0.60.0
android worked correctly
react-native run-ios build succeeded but installation of
app failed
The solution is not obvious, react-native-cli is trying to guess what xcode build configuration is currently setup on your computer which is what is happening on the function getBuildPath()
function getBuildPath(configuration, appName, isDevice, scheme) {
let device;
if (isDevice) {
device = 'iphoneos';
} else if (appName.toLowerCase().includes('tvos')) {
device = 'appletvsimulator';
} else {
device = 'iphonesimulator';
}
let buildPath = `build/${scheme}/Build/Products/${configuration}-${device}/${appName}.app`; // Check wether app file exist, sometimes `-derivedDataPath` option of `xcodebuild` not works as expected.
if (!_fs().default.existsSync(_path().default.join(buildPath))) {
return `DerivedData/Build/Products/${configuration}-${device}/${appName}.app`;
}
return buildPath;
}
The trick is not to patch this file, but to first setup your xcode configuration correctly Xcode > Preferences > Locations (see picture)
and Xcode > Preferences > Locations > Advanced
Once this is done, you have to cleanup your build folder, otherwise, react-native-cli will still assume that xcode is not behaving as expected, which will keep on producing the same error.
cd ios && rm -rf build
you can now execute npx react-native run-ios and everything should be fine again.
It took me quite some time to figure this out, I think that react-native-cli should output more details on what is going on under the hood for people not to be blocked.
Problem solved. I had to edit a file inside #react-native-community.
If anyone else has the same problem solution is below.
File location:
-> file:
-> node_modules
-> #react-native-community
-> cli-platform-ios
-> build
-> commands
-> runIOS
-> index.js line 314
Change:DerivedData/Build/Products/${configuration}-${device}/${appName}.app
To:build/Build/Products/${configuration}-${device}/${appName}.app
Cheers.

":CFBundleIdentifier", Does Not Exist: ReactNative 0.58 on Mac / iOS

I am following the ReactNative tutorial for 0.58. I do everything it says to do and I am crashing after running react-native run-ios. I have seen this extremely similar SO question from 2016.
I attempted react-native upgrade and it recommended doing react-native-git-upgrade.This did nothing. Same problem.
The bit on running ./configure in the question above after cd-ing into glog did nothing. There was no configure script there. In the path NewStupidProject/node_modules/react-native/scripts there is a script called ios-configure-glog.sh. I run bash ios-configure-glog.sh and it says ios-configure-glog.sh: line 31: ./configure: No such file or directory.
I have also attempted setting Xcode to use the legacy build system. This did not fix the issue. I am restarting my laptop now to see if that makes any of these changes take effect. No luck. At the top it says:
Found Xcode project NewStupidProject.xcodeproj Building using
"xcodebuild -project NewStupidProject.xcodeproj -configuration Debug
-scheme NewStupidProject -destination id=854019D1-8EE7-4D13-87E1-385E6CAC21BE -derivedDataPath build" User
defaults from command line:
IDEDerivedDataPathOverride = /Users/me/NewStupidProject/ios/build
Prepare build
note: Using legacy build system
=== BUILD TARGET double-conversion OF PROJECT React WITH CONFIGURATION Debug ===
When I go into the home directory and run react-native --version the output is:
[NewStupidProject](master)$ react-native --version
react-native-cli: 2.0.1
react-native: 0.58.4
[NewStupidProject](master)$
My output after crashing is:
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Install\ Third\ Party /Users/me/native_react_apps/NewStupidProject/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1 failure)
Installing
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app An
error was encountered processing the command
(domain=NSPOSIXErrorDomain, code=22): Failed to install the requested
application The bundle identifier of the application could not be
determined. Ensure that the application's Info.plist contains a value
for CFBundleIdentifier. Print: Entry, ":CFBundleIdentifier", Does Not
Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c
Print:CFBundleIdentifier
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at Promise.then (/Users/me/native_react_apps/NewStupidProject/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
How is it possible for the setup process to be this fraught with errors and this difficult?
WHY is this error message not in the Troubleshooting ReactNative setup?
HOW do I fix this? Is it possible to avoid this altogether in the future?
Other versioning info:
XCode: 10.1
Command Line Tools: 10.1
yarn: 0.27.5
watchman: 4.9.0
homebrew: 2.0.1
npm: 6.8.0
node: v11.9.0
macOS: 10.13.6
UPDATE:
I am trying to implement the solution in this issue in GitHub and I'm getting:
dyld: Library not loaded:
/usr/local/opt/readline/lib/libreadline.7.dylib Referenced from:
/usr/local/bin/awk Reason: image not found
./ios-install-third-party.sh: line 20: 24497 Broken pipe: 13
shasum -p "$cachedir/$file"
24498 Abort trap: 6 | awk -v hash="$hash" '{exit $1 != hash}' Incorrect hash: 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc
?/Users/me/.rncache/glog-0.3.5.tar.gz
UPDATE No. 2 I am trying to run the watchman watch-del-all command as recommended here to clear the cache for RN > 0.50 and the whole thing is hanging.
I tried modify the build system and it worked for me.
Detail:
Open your project workspace file in Xcode, and
File -> Workspace Settings -> Build system -> Legacy Build system

Resources