Cordova Xcode build failed "Permission denied" - ios

I am trying to build an iOS app using Xcode and Cordova, however I keep getting this error message:
cordova/lib/copy-www-build-step.sh: Permission denied
Has anyone overcome this problem before?

You can fix it like this also
cd platforms/ios/cordova/lib
sudo chmod +x copy-www-build-step.sh
This basically gives the file execute permission only instead of chmod 777 which gives it full permission (read, write, execute.) For anyone wanting clarification on what the difference is.

Faced exact same issue.
I guess git messed up the permissions between windows / mac.
cd platforms/ios/cordova/lib
sudo chmod 777 copy-www-build-step.sh
Then try to build the project. Worked for me.

Related

How to fix Shell Script Invocation Error MapFileParser.sh: Permission denied in Xcode

I'm working on a IOS Game that I built using Unity and I'm trying to get it to build on Xcode. However I keep getting this Shell Script Invocation Error "/Users/masterolu/Downloads/ShoeJackCityBuilds/iOS/MapFileParser.sh: Permission denied".
I've tried to use chmod +x /Users/masterolu/Downloads/ShoeJackCityBuilds/iOS/MapFileParser.sh but for some reason my machine doesn't recognize the chomd command anymore. I tried to reinstall it by using sudo apt install --reinstall coreutils but in order to use apt I need a JDK(Java Developer Kit). So I install the latest JDK and when I try to reinstall chomd my terminal says "Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin/apt" (-1)". At this point I decided it's best to come and ask for help.
Any ideas on how to fix this error in Xcode or how to install chomd so my app can run?
So, apparently Apple likes to disable the execution permission of all the shell scripts that have not been created on your machine (i.e. downloaded from web, cloned from repo) so what you have to do is to open a terminal inside the project folder and run chmod -x MapFileParser.sh, that should fix it.
I have also done it on the process_symbols.sh just to be sure it runs.
## EDIT ##
My solution for my gihub action was this as the -x version did not work correctly for my scenario.
- name: Update scripts permissions
run: |
pwd
sudo chmod 755 MapFileParser.sh
sudo chmod 755 process_symbols.sh
This works for me:
chmod 777 MapFileParser.sh

Ionic Project error of add platform

I have to add iOS platform in ionic but I get permission error. (EACCES: permission denied, open '/Users/macbookpro/.config/configstore/insight-cordova.json' You don't have access to this file.)
I have followed some steps regarding NPM but not got any solution.
Just try changing permissions of the file insight-cordova.json by below command:
sudo chmod -R 777 '/Users/macbookpro/.config/configstore/insight-cordova.json'
And this should fix the problem.

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.

Installing watchman when having a non-standard homebrew install

I am using React Native which needs watchman. When running react-native run-ios, I see this error.
watchman --no-pretty get-sockname returned with exit code=1, signal=null,
stderr= 2017-05-05T08:17:49,256: [2110218240] while computing sockname:
failed to create /usr/local/var/run/watchman/foo-state: No such file or directory
After investigating this, it seems that it is caused by not having a standard /usr/local/ homebrew install.
Is their a way to change the statedir being used by watchman?
I was able to solve this issue by creating the directory and giving my user the ownership of the directory.
sudo mkdir /usr/local/var/run/watchman/foo-state
sudo chown -R myusername /usr/local/var/run/watchman/foo-state
From watchman --help:
--statefile=PATH Specify path to file to hold watch and trigger state
So I think you need to use the --statefile option.
The safest way to resolve this is to delete the state dir. Run rm -rf /usr/local/var/run/watchman/root-state. This resolved the same problem for me.

iOS xcode 5 crashlytics error - Shell Script Invocation Error - ./Crashlytics.framework/run: Permission denied

I have Crashlytics Framework added to my project, with a script.
Run script:
Shell: /bin/sh
Script: ./Crashlytics.framework/run KEY_HERE
When I try to run the project, I get the following error:
Shell Script Invocation Error - ./Crashlytics.framework/run: Permission denied
BUT if i delete the framework and add it again, it runs fine... ONCE. Then the next time I get the same error. Then i have to delete it, and re-add it, for it to only run once, and then the same story...
Does anybody have an idea how to fix this? THANKS in advance.
Are you keeping your project and the Crashlytics framework in Dropbox? I've noticed that Dropbox changes/resets the permissions set.
Try pausing Dropbox sync and then set the permissions of Crashlytics.framework/run to 755.
UPDATE:
chmod 755 run only worked temporarily for me.
As Hemal Shah wrote in his answer, I also had to tell git to make run executable. You can do so by calling git update-index --chmod=+x run and committing that. (via this answer).
After having moved my project and the Crashlytics framework out of Dropbox, and doing this, there were no further issues with it.
In terminal just navigate to Crashlytics.framework folder if you use Crashlytics, in case you already use Fabric go to Fabric.framework folder. run should be there. And change permissions by running this in terminal: chmod 755 run.
Hemal from Crashlytics here!
A few things could be causing this - make sure that you're running the latest version of Crashlytics. If you click on the lower right-hand corner, then the release notes should show "- Added arm64 support for iPhone 5s."
Double check that if your SCM requires it, that the "run" binary is marked as executable!
Also, make sure you only have one copy of Crashlytics.app on your system and one copy of Crashlytics.framework in your project and that you're linking to the same copy being invoked.
I wanted to include my answer in case there is someone else who had this similar problem but is not using Crashlytics. I'm using Twitter Fabric and started get the error: ./Fabric.framework/run permission denied
Going to Build Phases and deleting the run script fixed this for me.
Edit: Adding to what I said above, just deleting the run script doesn't completely solve the problem, since you still need one to work with Fabric/Crashlytics. I ended up having to contact Crashlytics and this is what they told me (similar to #singhSan's resp0nse):
"Back up through the setup until you can click on the app-selector arrow in the top left corner. Then click on "+ New App" and select your project. This will function as a repair mode and get you the run script build phase you need."
Problem solved.
A simple and quick fix is to delete your Crashlytics framework and add it again in your project. This will fix the issue.
Run below commands in your project folder:-
chmod +x Crashlytics.framework/run
chmod +x Crashlytics.framework/uploadDSYM

Resources