React Native - launchPackager.command cant be opened - ios

I am having trouble building react native ios project.
Error message:
"launchPackage command" can't be opened because it is from an unidentified developer.
Any idea how to fix this?

Although this answer will most likely work, you would also allow all future apps from unidentified developers to be installed without being prompted.
To allow executing only the command in question (launchPackager.command), go to your react-native installation folder (most likely node_modules/react-native/scripts) in Finder and right-click launchPackager.command, choose Open and confirm by clicking Open again.
You will not be prompted again for this command as you have allowed execution specifically.

Another simple way is to delete node_modules folder from project directory and do npm install.
This happened because project was copied from old mac which had node_modules folder created by that old mac user, hence some problem occurs for project transferred to new mac.

Had the same problem on macOS Mojave.
This helped:
chmod 777 node_modules/react-native/scripts/launchPackager.command

on MacOS Catalina and above
Go to
System Preferences
Security & Privacy
Choose tab "Privacy"
Select "Developer Tools" on left pane
Check "Terminal" to allow terminal to run software locally which does not meet system's security policy . (please be aware of potential implications of this action and make sure that you know what you are doing )

Go to
System Preferences
Security & Privacy
Choose tab General
Choose Allow apps downloaded from anywhere or Allow apps downloaded from App Store and identified developers
I had the same error with you and this method worked for me.

chmod 777 node_modules/react-native/scripts/launchPackager.command
open terminal and Run the above command
after that Run the react-native run-android
Works for Me, It will Run :)

The reason is because you downloaded source code using virtual machine.
Solution:
Please download source code at your real machine.
And then copy it at VM, and build this project.

Related

The flutter tool cannot access the file or directory. Unable to grant read/write permissions for the current user

This is the first time I am installing flutter on the mac. I have followed all the steps that are told in flutter.dev. After setting up the path in .zshrc, I get this strange error.
The flutter tool cannot access the file or directory.
Please ensure that the SDK and/or project is installed in a location that has
read/write permissions for the current user.
This is the .zshrc file looks like.
After running flutter doctor getting this.
Thanks in advance.
I encountered this issue when moving my project from windows to a Mac folder. It seems to be an issue with some extended attributes. Using the below command worked for me.
sudo xattr -c -r <project_folder_path>
I'm not sure about this but try it. go to the folder where you installed Flutter, click the folder with to fingers which will show options. got to {Get info} look down at the Sharing & Permission, make sure your current user has read and write.
I just hope this will fix your problem

Xcode file permission issue

I updated my MacOS to Catalina, after that I am getting error reading issue in one project only. Check below image
When I try to open the file in my xcode, I got below error.
If I opened the same file from finder, then it opens the same file in xcode successfully. And issue is shifted to other file. I tried 7-8 times and it continuously coming from one file to another.
Already tried
Open backup project and still getting same issue.
Tried with changing the folder directory, like copied project to desktop, but still getting issue
Cleaned and build the project,
Restart my mac.
Note: I am getting issue in one project and rest of my projects are working file.
Is there any one time solution for this issue?
This error message can occur (somewhat misleadingly) if Xcode does not have permissions to access your Documents folder, and your project references a file that is not located within the same folder path as the project file.
The error message is misleading because the issue is not "you" (a user) lacking permission to view the file. The issue is that Xcode doesn't have permission to access the location of the file.
To resolve, go to System Preferences, Security & Privacy, Files and Folders, and enable Xcode to access the Documents folder. (Current as of MacOS 10.15.4 and Xcode 11.4.1)
You can change the permission from the Finder, right click on that file, goto info and then on bottom under sharing and permission change the privilege to read and write against your username. This might solve your issue.
Try changing the permission if not already done.
Enter the following in your terminal:
sudo chmod -R 777 /Users/macmini1/Desktop/Classes
It will ask for your password and then you will good to go.

The Dart Analyzer could not be started in vscode

I just updated Dart version and then my vscode warning me everytime, "The Dart Analyzer could not be started".
How can i solve this issue ?
Thank's
solved..!
give permission to access the flutter folder.
for MAC
go to the security & privacy section
then select the files and folders
under your IDE,
give permission to access the Flutter folder
In my case I put the flutter folder inside the document
This problem is solved by uninstalling the Dart sdk manually from the computer, and re-install it.
If anyone face the same problem, please uninstall your dart sdk And install it again. Make sure you re-start your vscode IDE.
Hope this will helpful if you face the same problem.
--- Happy Coding ---
I had a permission issue. I just go through the log and seems unable to create .dart directory in the home folder.
Here is the solution:
- This solution for mac only
- cd ~
- cd ..
- whoami
- sudo chown {username} {userfolder}
In my case a simple restart of VSCode was needed - it seems as if there was a Dart update pending that VSCode did not notify me about.

React Native running app on device without server

Its unbelievable how bad the documentation is for React Native, they just put as little as possible for everything. I've already managed to run my app using option 1 but option 2 is even more unclear: https://facebook.github.io/react-native/docs/running-on-device-ios.html
I don't know there's no example of the terminal command react-native bundle in full so I know what is actually required there. For example --entry-file <path> what path? The whole path from my hard drive root to this folder, or just the file itself? --bundle-output....? What the hell do I need to put for that? I don't know why they need to make it so damn unclear.
I'm surprised there's no other resources online that give the instructions more clearly. I guess that's why there aren't so many React Native apps on the app store.
I hope you also find that this is a much easier approach. In the example below, my app was named BleMobileApp. Feel free to change it to your app's name.
RUN APP ON DEVICE WITHOUT DEBUG SERVER
Duplicate the main deployment target and name it BleMobileApp-Deploy.
Make sure to REMOVE the DEBUG=1 flag in BleMobileApp-Deply's Build settings (Do not touch the original target BleMobileApp!)
Add a New Run Script Phase to BleMobileApp-Deploy's Build phases and paste following command:
yes | cp -rf ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/main.jsbundle $SRCROOT/main.jsbundle
That's it!
(OPTIONAL) In case you would like to MINIFY the JS Bundle!
Edit file ./node_modules/react-native/scripts/react-native-xcode.sh like below (Line 43~47)
2. Change the default run script like below (For BleMobileApp-Deploy target):
export NODE_BINARY=node
FORCE_MINIFYING=true ../node_modules/react-native/scripts/react-native-xcode.sh
This should do the trick for you.
Happy coding!
From React Native Docs:
Configure release scheme Building an app for distribution in the App Store requires using the Release scheme in Xcode. Apps built for Release will automatically disable the in-app Developer menu, which will prevent your users from inadvertently accessing the menu in production. It will also bundle the JavaScript locally, so you can put the app on a device and test whilst not connected to the computer.
To configure your app to be built using the Release scheme, go to Product → Scheme → Edit Scheme. Select the Run tab in the sidebar, then set the Build Configuration dropdown to Release.
This can be done from the terminal:
react-native run-ios --device "My iPhone" --configuration Release
the best way i could find,
just follow the step bellow
Product → Scheme → Edit Scheme
Select the Run tab in the sidebar
Build Configuration dropdown to Release
sometimes metro bundle starts, may be its bug in IOS but you can close it
Please see the attached screenshot

"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo." when using GCC

While attempting to compile my C program, running the following command:
gcc pthread.c -o pthread
Returns:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
and my code does not compile.
Why is this happening and how can I fix this problem?
Open up Xcode, and accept the new user agreement. This was happening because a new version of Xcode was downloaded and the new agreement was not accepted.
sudo xcodebuild -license
will take care of it with no trouble on the command line. Note that you'll have to manually scroll through the license, and agree to its terms at the end, unless you add "accept" to the command line :
sudo xcodebuild -license accept
Got stuck as I was trying to a go get ... I think it was related to git.
Here is how was able to fix it ...
I entered the following in terminal:
sudo xcodebuild -license
This will open the agreement. Go all the way to end and type "agree".
That takes care of go get issues.
It was quite interesting how unrelated things were.
Opening XCode and accepting the license fixes the issue.
You don't need to fiddle around with any command :)
Once the XCode is updated, open the Xcode IDE program. Please accept terms and conditions.
You are all set to go :))
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
A new version of OSX or XCode was installed and Apple wants you to agree to their Terms and Conditions. So just launch Xcode and "Agree" to them.
I had the same issue, after accepting the license launching XCode or running sudo xcodebuild -license accept i had to restart my Mac – otherwise it did not worked.
Follow these steps:
Open Terminal.
Enter this command: sudo xcodebuild --license.
Enter system password.
Agree to the license.
I had the same issue when I tried to use git.
It is possible to install git without it. And I doubt that gcc on mac is truly dependent on XCode. And I don't want to use root to accept something unless I'm sure I need it.
I uninstalled XCode by navigating to the applications folder and dragging XCode to the trash.
Now my git commands work as usual. I'll re-install XCode if/when I truly need it.
I'm facing the same issue.
The issue because of X-Code.
Solution:
1. Open X-code and accept user agreement (T&C).
or
2. Restart your MAC, It will resolve automatically.
If you have similar issues in Intellij do as others said above me :
Open Terminal.
Enter this command: sudo xcodebuild --license.
Enter system password.
Go to the end of file: Press space(button) to do that.
Type 'Agree' to the license.
And you are done.!!

Resources