Easy bounty here for grabs. Does not necessarily require any react-native experience. Problem seems to be in open source code, which is available out there:
Updated xcode, and now when I try to run my react-native app by issuing following command: react-native run-ios I get an error:
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/MyAppName.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
debug Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.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 (project-root-dir/node_modules/#react-native-community/cli/build/commands/runIOS/runIOS.js:181:45)
Before those errors, the command prints out info about successful build, and that it is about to install the build:
info ** BUILD SUCCEEDED **
info Installing DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.app
So it seems the build is ok, but when it tries to install the app it fails?
Think I've tried "everything" I found from other questions with this similar error message, but nothing has worked for me.
Some specs:
react-native: 0.59.10
react: 16.8.3
xcode-version: Version 12.2 (12B45b)
I know there are similar questions on stackoverflow. But since none of the solutions provided there worked for me, and I wish to get it fixed, I made this separate question.
I do not know where the Info.plist file is that it tries to find: DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.app/Info.plist
Inside my ios folder, there is a folder called DerivedData, but inside that there are no folder with a name Build. So I think it might be looking from a wrong location?
UPDATE:
I've been able to pinpoint where the cli launch goes wrong:
https://github.com/react-native-community/cli/blob/ba298d9c47af522f0377325bebc6c2075d41790a/packages/platform-ios/src/commands/runIOS/index.ts#L378
If I change that line let buildPath = build/${scheme}/Build/Products/${configuration}-${device}/${appName}.app
to -> build/${scheme}/Build/Products/${configuration}-${device}/MyAppRealName.app;
Then the dev launch works nicely, there's no problem. So it seems that getting the appName goes wrong. The appName is resolved here: https://github.com/react-native-community/cli/blob/ba298d9c47af522f0377325bebc6c2075d41790a/packages/platform-ios/src/commands/runIOS/index.ts#L387
const productNameMatch = /export FULL_PRODUCT_NAME="?(.+).app"?$/m.exec(buildOutput);
I could do a post install npm script that just sets the name of the app correct and call it a day. But that's pretty hacky way. I wonder if there's an alternative that works better? I see that the runIOS file has been updated from the version that I have quite much, but the function getProductName still remains the same. So Im not sure if updating just the cli would work, or if it would even be possible, because it might require a newer react-native version, which is not an option for me right now.
newer version of #react-native-community/cli is not working on older version react-native because in newer version they have change getProductName to getPlatformName. for more detail you can read summary of this PR
Solution
As a local workaround, patch the package by patch-package node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js and edited getProductName (lines 362–365) to read:
function getProductName(buildOutput) {
const productNameMatch = /export FULL_PRODUCT_NAME\\?="?(.+).app"?$/m.exec(buildOutput);
return productNameMatch ? productNameMatch[1].replace(/(?:\\(.))/g, '$1') : null;
}
The result from react-native run-ios is:
DerivedData/Build/Products/Debug-iphonesimulator/MyAppName.app/Info.plist
The correct should be:
DerivedData/Build/Products/Debug-iphonesimulator/MyAppRealName.app/Info.plist
Then you could fix it by edit Xcode project as:
Open Product menu (status bar)
Scheme -> Edit Scheme
Under build section, add a post-action
In provide build settings from: choose target of your app
Use the script to copy wrongname.app to realname.app: cp ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app ${BUILT_PRODUCTS_DIR}/real_name.app
Or you can use symlinks instead of copying.
Related
I'm using M1 chip and xCode 13.4.1. I get the following React Native error while executing the app in the simulator:
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/Ibra/Library/Developer/Xcode/DerivedData/Mario-girhlsdkqiibhqhflwlyrybpo/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-46EB2E110.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
The problem persists even when I start a brand-new React Native project and try to execute it on iOS. What led to the error and how can it be fixed?
Thank you
Described answers didn't help me, but I started reading error description: and I found out that in error description on the line 2: my folder's name was written partially. Folder name consisted 2 words divided by 1 space example: "My folder" in the error was written just "My". I just changed folder's name to "MyFolder" and it helped me to fix the problem
it has multiple solutions:
to solve this run this command in terminal in ios folder , pod deintergrate and install pod with the commad pod install
Restart your Mac , it is some time due to cache, delete derived data and logs from XCode -> Prefrences and location
I faced same issue and I figured out following solutions:
What worked for me was npx react-native-clean-project and choosing y for all options, this will clean your React Native project by purging caches and modules, and reinstalling them again.
And here're some solutions that worked for others:
If you're using nvm, nvm unalias default could solve the issue.
This error could be due to Xcode can't find your node path, so try sudo ln -s $(which node) /usr/local/bin/node
Delete node_modules then cd ios && pod deintegrate then reinstall node modules and npx react-native start --reset-cache
I solve this issue with below procedure:
Keychain Access > Cetificates > Login
Find any Apple Certificate that has the blue + symbol
Change it to "Use System Defaults" and close it.
You'll see a pop up. Type in your password to update settings.
Close Keychain. Open your project, clean build files and run.
Note: Mac with M1, Xcode 14.1
I'm somewhat new to react native and expo but I've been trying to deploy a test version to my phone but can't figure out how to get it to build.
For some extra context, I built most of it in Expo and then ejected it (yes I know this isn't the best choice but I liked the features Expo provided). I ejected it because I needed NFC support which isn't currently supported in Expo so I added that in manually in Xcode after I ejected.
When I open the Xcode workspace and try to deploy it to my phone I get the following error:
Error: Failed to connect to the packager server. If you did not start this build by running 'react-native run-android', you can start the packager manually by running 'react-native start' in the project directory. (Error: Request to packager server failed: 500)
at /Users/user/Downloads/honorProj-reactNatveFinal/honorProj/reactNative/ethelontisApp/node_modules/expo-updates/scripts/createManifest.js:40:11
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Command PhaseScriptExecution failed with a nonzero exit code
I know it says run react-native start in the project directory (although I'm not entirely what the at /Users/... is refering too) but what really threw me was that it mentioned react-native run-android which doesn't seem like it should be related at all.
Lastly I'm completely and utterly lost with what Command PhaseScriptExecution is.
Thanks for the help.
I was facing the exact same issue. So I just completed the set up the android development first.
But before doing anything, follow the below steps, it may solves the problem.
Step-1: Open terminal and navigate to your project directory example: cd Your project path.
Step-2: Type npx react-native start
Step-3: If you get any error like "error listen EADDRINUSE: address already in use :::8081"
Then follow step-4 to 6:
Step-4 : type sudo lsof -n -i4TCP:8081 // You will get PID from here
Step-5: type kill -9 PIDvalue
Step-6: Repeat the step 2 and 3 once again
If you will not get any error in step- 2 then type npx react-native run-android
and check if there is any error. If yes, then you have to set up the android development first to make it working - (As of now I found this way, but not sure if anyone can find any better way).
Else Open the code using xcode then clean the build and also clean the build folder then try to run.
Thanks, Hope it will help.
I had problems with the flutter_facebook_login package, more specific with the pod file when building for iOS. After some research I've updated the pod repo, removed the pod.lock file, run pod install and everything installed fine but now I get this error
bin/sh: /Users/xxx(bin/xcode_backend.sh: Not a directory Command
PhaseScriptExecution failed with a nonzero exit code
note: Using new build systemnote: Planning buildnote: Constructing build description
... and I have no idea what happens. So far I've locked and unlocked the login in the keychain access, like suggested an answer on stackoverflow, then added Flutter SDK path in User-Defined Settings, following another answer, but the issue persists.
Can anyone help me with this, please?
I've figured it out.
In Xcode Targets, Project Name (Runner in this case) Build Settings, added new build setting:
FLUTTER_ROOT and then the PATH to the flutter directory /Users/user_name/Developer/flutter/ in my case and it works fine.
Screenshot:
I've followed this answer
I am trying to install chromaticity on my own machine for testing, and no matter what i do i will always hit the error seen in this picture installation error
I dont know why it happened i tried searching but i found nothing online. my question is does anyone know why it happens? or can point me to the right direction? i have checked the folders and yes there are no GO files in there but i dont see why that is a problem
The api could be found here: https://github.com/evq/chromaticity
This is not an issue (as in bug) on the project, rather an issue due to lack of documentation on how to build the project itself.
If you look at the Makefile file on the root directory, you'll notice that static/static.go is a generated file as part of the build process. Such file is usually not committed to the repo so you'll need to build it yourself. To do so, you'll need to have go-bindata installed.
Here's what you need to do in order to build the project successfully:
Get the go-bindata package
go get -u github.com/jteeuwen/go-bindata/...
Get the project
go get github.com/evq/chromaticity
Go the project root directory
cd [...the chromaticity project root..]
Run make to generate the static/static.go file
make
Build/ install the project
go install
Update:
Noticed from your screenshot that you're using Windows, in that case you may need to workaround the issue of running Makefile in Windows. See here for possible solution: How to run a makefile in Windows?
I've run into the same issue when trying to "get" and then install this project. I looked into the code and there is no trace of Asset() function in github.com/evq/chromaticity/static. Moreover git history does not show any .go files in static/ directory. Personally, I would create issue in the project and/or look for different repo containing desired functionality.
maybe the same question here
, I follow official website tutorial workflow and try to build AwesomeProject, but even I choose different version, problem still exist
I can't describe clearly and directly screenshot below
certainly I installed react-native by following official guide step
$ npm install -g react-native-cli
$ react-native init AwesomeProject
could anybody help me out of this error, thx ..
Find out where react-native is installed, using which react-native, then change the reference to react-native, within the script called by Xcode, to /full/path/to/react-native.
Harder way: Modify the $PATH that Xcode uses so it looks in the new path. I wouldn't do this as it's hassle and appears to change with every version of OSX. I think it's done by editing /etc/paths and restarting; not sure though.