Use of "sudo" has broken my Cordova - macos

Someone made the mistake of using "sudo ionic add platform ios" and it has entirely broken my cordova for x-Code.
Nothing will build in x-code due to permission problems about accessing Cordova.
If I run "ionic platform add ios", it gives me:
Error: EACCES: permission denied, open '/Users/mac1/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.
During the build, it gives me a build failed message:
" CompileC build/stashd.build/Debug-iphonesimulator/stashd.build/Objects-normal/i386/MyMainViewController.o stashd/Plugins/com.telerik.plugins.wkwebview/MyMainViewController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/mac1/Dev/John/ionic5/platforms/ios/cordova/build-debug.xcconfig,-project,stashd.xcodeproj,ARCHS=i386,-target,stashd,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/mac1/Dev/John/ionic5/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/mac1/Dev/John/ionic5/platforms/ios/build/sharedpch"
Trying to run in x-code it tells me
You don’t have permission to save the file “project.xcworkspace” in the folder “stashd.xcodeproj”.
Again- all this started to happen when Sudo was used (I never had to use it before, and ionic/Cordova worked perfectly).
So far I've:
Removed & re-installed Node.js, Ionic, NPM and Cordova. None have helped- I still require sudo.

First remove ios platform use sudo:
sudo ionic platform rm ios
or:
sudo rm -rf platforms
And then, delete files that can't be visited:
sudo rm ~/.config/configstore/update-notifier-cordova.json
And then, add ios platform without sudo:
ionic platform add ios
Hope this will help, regards.

Related

React-Native Error + Bug in Ruby Interpreter: Failed to install CocoaPods dependencies for iOS project, which is required by this template

I am very new to Apple and app programming so please forgive me if I am not asking my questions in the perfect "format" that you might be expecting...
I bought my MacBook Air running on M1 chip just few days ago and would like to program with Xcode and React Native. As I do the common command "npx react-native init AwesomeProject" I got into the error which I saw quite some other people also run into:
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
I tried all of the suggestions available on other posts (assuming I am understanding the remedies correctly and making the changes accordingly) but none seem to work for me.
I tried also the default suggested solution which is:
Please try again manually: "cd ./AwesomeProject/ios && pod install".
And I seem to get something different from others, which is:
Analyzing dependencies Fetching podspec for DoubleConversion from
../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Fetching podspec for RCT-Folly from
../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
Fetching podspec for glog from
../node_modules/react-native/third-party-podspecs/glog.podspec
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi/library.rb:275: [BUG]
Bus Error at 0x0000000102a08000 ruby 2.6.3p62 (2019-04-16 revision
67580) [universal.arm64e-darwin20]
and then
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Is it something to do with my Ruby interpreter? If yes, what are the commands I could use to solve the issue???
https://github.com/CocoaPods/CocoaPods/issues/10349#issuecomment-849468291
brew install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
In my case, need to restart my terminal before execute pod install. Monterey + M1.
The top answer doesn't work for me on my MBP M1 so I fixed the issue this way :
Make sure you have opened project.xcworkspace and not the project.xcodeproj
Open the workspace file with xcode with clicking on it then go to File -> Workspace Settings ... -> Build System -> Legacy Build System
Select the project file then the Target then go to Build Settings Tab and Search Paths
Double click on Library Search Paths Debug and move the $(inherited) to the bottom of the list
Do the same for the Release .
Then Build Again and you're good to go .
If you still get any errors run these commands in the ios folder of the react native project and do the above steps again and it will build successfully.
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod install
If you are facing this issue in Mac Big Sur, reinstalling CommandLineTools can fix this issue.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Errors after update, BigSur 11.3 XCode 12.5 (12E262) React-Native and Expo

After upgrading BigSur to 11.3, Xcode to 12.5 and iOS to 14.5, I can't run the iOS app on a real device nor in the simulator.
React-Native -->
react-native run-ios
kikirim#Levent-MacBook-Pro test % react-native run-ios
error Could not find "Podfile.lock" at /Users/kikirim/Desktop/React-Native/test/ios/Podfile.lock. Did you run "pod install" in iOS directory?
info Found Xcode project "test.xcodeproj"
xcrun: error: active developer path ("/Volumes/MacOS/MacOs_Prog/Xcode-12.5.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
(node:5077) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
error Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues.
Error: Command failed: xcrun simctl list --json devices
xcrun: error: active developer path ("/Volumes/MacOS/MacOs_Prog/Xcode-12.5.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:15)
at runOnSimulator (/Users/kikirim/Desktop/React-Native/test/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:164:54)
at Object.runIOS [as func] (/Users/kikirim/Desktop/React-Native/test/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:121:12)
at Command.handleAction (/Users/kikirim/Desktop/React-Native/test/node_modules/#react-native-community/cli/build/index.js:186:23)
at Command.listener (/Users/kikirim/Desktop/React-Native/test/node_modules/commander/index.js:315:8)
at Command.emit (events.js:315:20)
at Command.parseArgs (/Users/kikirim/Desktop/React-Native/test/node_modules/commander/index.js:651:12)
at Command.parse (/Users/kikirim/Desktop/React-Native/test/node_modules/commander/index.js:474:21)
at setupAndRun (/Users/kikirim/Desktop/React-Native/test/node_modules/#react-native-community/cli/build/index.js:265:24)
info Run CLI with --verbose flag for more details.
kikirim#Levent-MacBook-Pro test %
React-Expo -->
npm run ios
** BUILD FAILED **
The following build commands failed:
CompileC /Users/kikirim/Library/Developer/Xcode/DerivedData/text-gncpkkxvjxsnedbswzsxcynreivq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/DistributedMutex.o /Users/kikirim/Desktop/React-Native/text/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
It seems that there is an issue with Flipper. I am not using Flipper so i just commented it out.
cd ios
comment Flipper out from podfile:
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
run "pod deintegrate"
pod install
cd ..
npm run ios
You should update react native with following these steps:
https://react-native-community.github.io/upgrade-helper
Otherwise you will face with multiple issue.

Install grpc extension on Mac OS Big Sur

For 2 days now, I am trying to install grpc for php on my Mac mini server
Mac OS Big Sur 11.2.1
Built-in Apache
I have tried it on php 7.3 and 7.4 installed with homebrew
I have installed grpc pecl grpc install after a bunch of attempt I have finally compile and installed it with pecl.
extensions are placed in the good repertory. But I encounter signing issue.
php -m show grpc in the list but not php_info()
PHP Warning: PHP Startup: Unable to load dynamic library 'grpc.so' (tried: /usr/local/lib/php/pecl/20190902/grpc.so (dlopen(/usr/local/lib/php/pecl/20190902/grpc.so, 9): no suitable image found. Did find:\n\t/usr/local/lib/php/pecl/20190902/grpc.so: code signature in (/usr/local/lib/php/pecl/20190902/grpc.so) not valid for use in process using Library Validation: mapping process is a platform binary, but mapped file is not\n\t/usr/local/lib/php/pecl/20190902/grpc.so: stat() failed with errno=1), /usr/local/lib/php/pecl/20190902/grpc.so.so (dlopen(/usr/local/lib/php/pecl/20190902/grpc.so.so, 9): image not found)) in Unknown on line 0
I have disabled SIP. Still same issue.
I have codesigned the extension with my apple developper ID. codesign -f -s "Mac Developer: MY_DEV_ID" /usr/local/lib/php/pecl/20190902/grpc.so
same issue
I have xattr /usr/local/lib/php/pecl/20190902/grpc.so
then sudo xattr -d com.apple.quarantine /usr/local/lib/php/pecl/20190902/grpc.so
I also tried with gatekeeper disabled.
And still the same problem. Is there someone that sucssefully installed grpc on the Mac with Big Sur, who would have an idea on what is going wrong ?
I experienced the same thing, I have tried several times to install it and I just solved the problem.
In my case when running
sudo pecl grpc install
there was an error in the installation process with error information like
ERROR: failed to mkdir /usr/local/Cellar/php#7.4/7.4.15/pecl/20190902
see in the picture:
running pecl grpc install
The problem is that the installation process can't create a new directory for /usr/local/Cellar/php#7.4/7.4.15/pecl/20190902, so I tried to create that directory first by running the command:
mkdir /usr/local/Cellar/php#7.4/7.4.15/pecl/
Then run the installation process again and and it worked!
1. See Cellar/php/... directory:
for me:
for you:
ls -la /usr/local/Cellar/php/YOUR_PHP_VERSION/
2. See the directory "pecl" which is a link:
3. Check the link:
ls -la /usr/local/lib/php/pecl
if:
No such file or directory
execute:
mkdir -p /usr/local/lib/php/pecl
sudo chmod 777 /usr/local/lib/php/pecl/
4. Reinstall extension:
pecl install grpc

How to solve Android Studio problems?

Hello I have installed in my Ubuntu Android Studio with the intention of using them SDK with React Native, Cordova, Phonegap, etc.
I have searched other questions on this site and tried the solutions they offered, but the result so far is that what I show next, after 10 days installing and testing I have decided to ask my question.
I made the installation according to the official page of Android Studio and in several ways, but I can not get it to work.
Now I have the installation of the following way, to avoid problems of permissions:
Copy the downloaded folder from Android Studio to /usr/local/
For the SDK I chose a folder in my personal folder /home/charly/Android/sdk/
Install the necessary libraries for 32-bit sudo apt-get install libc6: i386 libncurses5: i386 libstdc ++ 6: i386 lib32z1 lib32bz2-1.0
To run the Android Studio installer, I placed it in the Android Studio location in the bin folder using the terminal:
cd/usr/local/android-studio/bin
Execute: ./studio.sh
I edit the .bashrc file: sudo vim ~/.bashrc and add the following to the end of the file:
export PATH=${PATH}:/home/charly/Android/sdk/tools
export PATH=${PATH}:/home/charly/Android/sdk/platform-tools
Install:
sudo apt-get install lib32stdc ++ 6
sudo apt-get install lib32z1
When I run android sdk and android avd the answer is: Order «android» not found. When should I take the SDK Manager and AVD Manager, respectively.
Also, there is another problem and when executing printenv ANDROID_HOME the result of the console is: /opt/android-sdk/ And in this folder is not Android Studio.
When I try to run an Android application from React Native: react-native run-android I get an error:
S server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug) ...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ': app'.
> The SDK directory '/ opt / android-sdk' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: ./gradlew installDebug
Error: Command failed: ./gradlew installDebug
    at checkExecSyncError (child_process.js: 611: 11)
    at Object.execFileSync (child_process.js: 629: 13)
    at runOnAllDevices (/home/charly/proyec/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
    at buildAndRun (/home/charly/proyect/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
    at isPackagerRunning.then.result (/home/charly/proyect/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
    at process._tickCallback (internal / process / next_tick.js: 68: 7)
How can I solve these problems?
Why does it tell me that SDKs do not exist in '/opt/android-sdk' if I set up .bashrc to say they are in home/charly/Android/sdk?
Maybe the question is extensive, but I want to explain the whole installation and they can see the mistakes I've made in this one.
Thank you
You need to set the ANDROID_HOME environment variable in one of your bash startup scripts. This is explained in detail elsewhere on Stackoverflow.
Alternatively, you could add a local.properties file to configure the SDK location.

Phonegap installation fails using npm

I followed this Up and running with PhoneGap on Mac OSX on every single step but then I got stuck with
I have tried many solutions and fixes but still nothing is working. I followed this answer but still stuck.
What could be the cause for these issues?!
Update1:
When I install cordova using sudo npm install -g cordova I get the following:
Even when I type cordova, I get -bash: cordova: command not found
Update2:
I fixed cordova installation using the following steps:
sudo chown -R $USER /usr/local
sudo chmod -R 0775 /usr/local
Add it to the path using this answer
Add the path to bash_profile using this link
Open the terminal and type cordova -v and you get it working displaying the version
Phonegap is still failing and can't seem to find a fix for it

Resources