Npx cap sync ios ERROR

I have 2 identical projects, in terms of Ionic version, Angular version, and all other NPM packages. With one of the projects, when either attempting to add platform “iOS” or sync it, I get the following error:

:heavy_multiplication_x: Updating iOS native dependencies with pod install - failed!
:heavy_multiplication_x: update ios - failed!
[error] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin22/rbconfig.rb:21:
warning: Insecure world writable dir /Users/tolga/Code/TOLGA-Git/XENATECH in PATH, mode 040777
Ignoring ffi-1.15.5 because its extensions are not built. Try: gem pristine ffi --version 1.15.5
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as
root. (CLAide::Help)

An initial Google search didn’t result in any helpful suggestions. PLease advice, thank you.

Same computer and one project works and the other doesn’t?
That’s weird because the problem seems CocoaPods related, so should’t work on any of them.

How did you install CocoaPods? looks like it’s installed as root.

Or might be related to folder permissions, can you check if they are different in the 2 projects?

maybe one project has older plugins versions and npx cap sync works finr with ruby 2.6, the other project could have other libraries which needs a ruby newer version

it happened to me a lot of times

he needs to upgrade ruby, i guess

Did you found any solution? Same thing is happening to me… it’s really frustrating and I can’t build any version for IOS… Console app from MAC works too bad… 0 developer friendly.

I think it’s related to the EACCES permissions but I don’t know how to fix it.

Ionic CLI 7.1.1 and Project with Ionic 7 and capacitor 5 (Angular)

  1. Uninstall Ruby with: brew uninstall ruby --force
  2. Uninstall CocoaPods. At first, try to list all CocoaPods versions / components with gem list --local | grep cocoapods. Then uninstall them one by one, in my case:

sudo gem uninstall cocoapods

sudo gem uninstall cocoapods-core

sudo gem uninstall cocoapods-downloader

etc.

  1. As a next step I was able to reinstall ffi and then CocoaPods with:

sudo arch -x86_64 gem install ffi

sudo arch -x86_64 gem install cocoapods

Once done, I could run pod install as expected.
(maybe you will need to run pod update before)

if you want, after uninstalling you can use homebrew to install cocoapods

capacitor sync
[capacitor] :heavy_check_mark: Copying web assets from www to android/app/src/main/assets/public in 373.41ms
[capacitor] :heavy_check_mark: Creating capacitor.config.json in android/app/src/main/assets in 1.34ms
[capacitor] [info] Found 12 Cordova plugins for android:
[capacitor] cordova-launch-review@4.0.1
[capacitor] cordova-plugin-advanced-http@3.2.2
[capacitor] cordova-plugin-app-version@0.1.13
[capacitor] cordova-plugin-device@2.0.3
[capacitor] cordova-plugin-document-viewer@1.0.0
[capacitor] cordova-plugin-file@6.0.2
[capacitor] cordova-plugin-file-opener2@3.0.5
[capacitor] cordova-plugin-fingerprint-aio@5.0.1
[capacitor] cordova-plugin-inappbrowser@5.0.0
[capacitor] cordova-plugin-network-information@3.0.0
[capacitor] cordova-plugin-screen-orientation@3.0.2
[capacitor] es6-promise-plugin@4.2.2
[capacitor] :heavy_check_mark: copy android in 554.33ms
[capacitor] :heavy_check_mark: Updating Android plugins in 13.75ms
[capacitor] [info] Found 18 Capacitor plugins for android:
[capacitor] @capacitor/action-sheet@4.0.1
[capacitor] @capacitor/app@4.0.1
[capacitor] @capacitor/app-launcher@4.0.1
[capacitor] @capacitor/browser@4.0.1
[capacitor] @capacitor/camera@4.0.1
[capacitor] @capacitor/device@4.0.1
[capacitor] @capacitor/dialog@4.0.1
[capacitor] @capacitor/filesystem@4.0.1
[capacitor] @capacitor/geolocation@4.0.1
[capacitor] @capacitor/haptics@4.0.1
[capacitor] @capacitor/keyboard@4.0.1
[capacitor] @capacitor/local-notifications@4.0.1
[capacitor] @capacitor/network@4.0.1
[capacitor] @capacitor/preferences@4.0.1
[capacitor] @capacitor/push-notifications@4.0.1
[capacitor] @capacitor/splash-screen@4.0.1
[capacitor] @capacitor/status-bar@4.0.1
[capacitor] @capacitor/toast@4.0.1
[capacitor] [info] Found 12 Cordova plugins for android:
[capacitor] cordova-launch-review@4.0.1
[capacitor] cordova-plugin-advanced-http@3.2.2
[capacitor] cordova-plugin-app-version@0.1.13
[capacitor] cordova-plugin-device@2.0.3
[capacitor] cordova-plugin-document-viewer@1.0.0
[capacitor] cordova-plugin-file@6.0.2
[capacitor] cordova-plugin-file-opener2@3.0.5
[capacitor] cordova-plugin-fingerprint-aio@5.0.1
[capacitor] cordova-plugin-inappbrowser@5.0.0
[capacitor] cordova-plugin-network-information@3.0.0
[capacitor] cordova-plugin-screen-orientation@3.0.2
[capacitor] es6-promise-plugin@4.2.2
[capacitor] :heavy_check_mark: update android in 159.56ms
[capacitor] :heavy_check_mark: Copying web assets from www to ios/App/App/public in 349.02ms
[capacitor] :heavy_check_mark: Creating capacitor.config.json in ios/App/App in 687.21μs
[capacitor] [info] Found 12 Cordova plugins for ios:
[capacitor] cordova-launch-review@4.0.1
[capacitor] cordova-plugin-advanced-http@3.2.2
[capacitor] cordova-plugin-app-version@0.1.13
[capacitor] cordova-plugin-device@2.0.3
[capacitor] cordova-plugin-document-viewer@1.0.0
[capacitor] cordova-plugin-file@6.0.2
[capacitor] cordova-plugin-file-opener2@3.0.5
[capacitor] cordova-plugin-fingerprint-aio@5.0.1
[capacitor] cordova-plugin-inappbrowser@5.0.0
[capacitor] cordova-plugin-network-information@3.0.0
[capacitor] cordova-plugin-screen-orientation@3.0.2
[capacitor] es6-promise-plugin@4.2.2
[capacitor] :heavy_check_mark: copy ios in 397.05ms
[capacitor] :heavy_check_mark: Updating iOS plugins in 14.29ms
[capacitor] [info] Found 18 Capacitor plugins for ios:
[capacitor] @capacitor/action-sheet@4.0.1
[capacitor] @capacitor/app@4.0.1
[capacitor] @capacitor/app-launcher@4.0.1
[capacitor] @capacitor/browser@4.0.1
[capacitor] @capacitor/camera@4.0.1
[capacitor] @capacitor/device@4.0.1
[capacitor] @capacitor/dialog@4.0.1
[capacitor] @capacitor/filesystem@4.0.1
[capacitor] @capacitor/geolocation@4.0.1
[capacitor] @capacitor/haptics@4.0.1
[capacitor] @capacitor/keyboard@4.0.1
[capacitor] @capacitor/local-notifications@4.0.1
[capacitor] @capacitor/network@4.0.1
[capacitor] @capacitor/preferences@4.0.1
[capacitor] @capacitor/push-notifications@4.0.1
[capacitor] @capacitor/splash-screen@4.0.1
[capacitor] @capacitor/status-bar@4.0.1
[capacitor] @capacitor/toast@4.0.1
[capacitor] [info] Found 12 Cordova plugins for ios:
[capacitor] cordova-launch-review@4.0.1
[capacitor] cordova-plugin-advanced-http@3.2.2
[capacitor] cordova-plugin-app-version@0.1.13
[capacitor] cordova-plugin-device@2.0.3
[capacitor] cordova-plugin-document-viewer@1.0.0
[capacitor] cordova-plugin-file@6.0.2
[capacitor] cordova-plugin-file-opener2@3.0.5
[capacitor] cordova-plugin-fingerprint-aio@5.0.1
[capacitor] cordova-plugin-inappbrowser@5.0.0
[capacitor] cordova-plugin-network-information@3.0.0
[capacitor] cordova-plugin-screen-orientation@3.0.2
[capacitor] es6-promise-plugin@4.2.2
[capacitor] :heavy_multiplication_x: Updating iOS native dependencies with pod install - failed!
[capacitor] :heavy_multiplication_x: update ios - failed!
[capacitor] [error] /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:439:in help!': [!] You cannot run CocoaPods as root. (CLAide::Help) [capacitor] [capacitor] Usage: [capacitor] [capacitor] $ pod COMMAND [capacitor] [capacitor] CocoaPods, the Cocoa library package manager. [capacitor] [capacitor] Commands: [capacitor] [capacitor] + cache Manipulate the CocoaPods cache [capacitor] + env Display pod environment [capacitor] + init Generate a Podfile for the current directory [capacitor] + install Install project dependencies according to versions from a [capacitor] Podfile.lock [capacitor] + ipc Inter-process communication [capacitor] + lib Develop pods [capacitor] + list List pods [capacitor] + outdated Show outdated project dependencies [capacitor] + repo Manage spec-repositories [capacitor] + setup Set up the CocoaPods environment [capacitor] + spec Manage pod specs [capacitor] + update Update outdated project dependencies and create new Podfile.lock [capacitor] [capacitor] Options: [capacitor] [capacitor] --allow-root Allows CocoaPods to run as root [capacitor] --silent Show nothing [capacitor] --version Show the version of the tool [capacitor] --verbose Show more debugging information [capacitor] --no-ansi Show output without ANSI codes [capacitor] --help Show help banner of specified command [capacitor] from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:102:in ensure_not_root_or_allowed!’
[capacitor] from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:48:in run' [capacitor] from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/bin/pod:55:in <top (required)>’
[capacitor] from /usr/local/bin/pod:23:in load' [capacitor] from /usr/local/bin/pod:23:in
[capacitor]
[ERROR] An error occurred while running subprocess capacitor.

    capacitor sync exited with exit code 1.
    
    Re-running this command with the --verbose flag may provide more information.

not working for me… i.m totally desperate… it’s happening in all the projects I,m try to build…

Normally I resolve this issue with one of two solutions.

  1. cd into ios/app directory and issue pod install / pod update command and try again
  2. delete ios platform, delete node_modules then npm install then ionic cap add ios

Once done run npx sync

I can’t do cap add iOS without use SUDO. Because of this:
ionic cap add ios

npm i -E @capacitor/ios@4.0.1
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@es-joy/jsdoccomment@0.22.1’,
npm WARN EBADENGINE required: { node: ‘^12 || ^14 || ^16 || ^17’ },
npm WARN EBADENGINE current: { node: ‘v18.14.0’, npm: ‘9.3.1’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘eslint-plugin-jsdoc@38.1.4’,
npm WARN EBADENGINE required: { node: ‘^12 || ^14 || ^16 || ^17’ },
npm WARN EBADENGINE current: { node: ‘v18.14.0’, npm: ‘9.3.1’ }
npm WARN EBADENGINE }
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /Users/diezsoftware/Desktop/Proyectos/DiezSoftware.AsesorMovil/AsesorMovil_2/node_modules/@swc/core-android-arm-eabi
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir ‘/Users/diezsoftware/Desktop/Proyectos/DiezSoftware.AsesorMovil/AsesorMovil_2/node_modules/@swc/core-android-arm-eabi’
npm ERR! [Error: EACCES: permission denied, mkdir ‘/Users/diezsoftware/Desktop/Proyectos/DiezSoftware.AsesorMovil/AsesorMovil_2/node_modules/@swc/core-android-arm-eabi’] {
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘mkdir’,
npm ERR! path: ‘/Users/diezsoftware/Desktop/Proyectos/DiezSoftware.AsesorMovil/AsesorMovil_2/node_modules/@swc/core-android-arm-eabi’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/diezsoftware/.npm/_logs/2023-05-24T08_02_29_818Z-debug-0.log
[ERROR] An error occurred while running subprocess npm.

    npm i -E @capacitor/ios@4.0.1 exited with exit code 243.

    Re-running this command with the --verbose flag may provide more information.

but if I use SUDO, then cocoapods says that I can’t use SUDO on the sync process…

sudo ionic cap add ios

npm i -E @capacitor/ios@4.0.1
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘@es-joy/jsdoccomment@0.22.1’,
npm WARN EBADENGINE required: { node: ‘^12 || ^14 || ^16 || ^17’ },
npm WARN EBADENGINE current: { node: ‘v18.14.0’, npm: ‘9.3.1’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘eslint-plugin-jsdoc@38.1.4’,
npm WARN EBADENGINE required: { node: ‘^12 || ^14 || ^16 || ^17’ },
npm WARN EBADENGINE current: { node: ‘v18.14.0’, npm: ‘9.3.1’ }
npm WARN EBADENGINE }

up to date, audited 1470 packages in 3s

154 packages are looking for funding
run npm fund for details

25 vulnerabilities (10 moderate, 11 high, 4 critical)

To address issues that do not require attention, run:
npm audit fix

To address all issues (including breaking changes), run:
npm audit fix --force

Run npm audit for details.

capacitor add ios
[capacitor] :heavy_check_mark: Adding native Xcode project in ios in 63.40ms
[capacitor] :heavy_check_mark: add in 64.11ms
[capacitor] :heavy_check_mark: Copying web assets from www to ios/App/App/public in 361.19ms
[capacitor] :heavy_check_mark: Creating capacitor.config.json in ios/App/App in 870.75μs
[capacitor] [info] Found 12 Cordova plugins for ios:
[capacitor] cordova-launch-review@4.0.1
[capacitor] cordova-plugin-advanced-http@3.2.2
[capacitor] cordova-plugin-app-version@0.1.13
[capacitor] cordova-plugin-device@2.0.3
[capacitor] cordova-plugin-document-viewer@1.0.0
[capacitor] cordova-plugin-file@6.0.2
[capacitor] cordova-plugin-file-opener2@3.0.5
[capacitor] cordova-plugin-fingerprint-aio@5.0.1
[capacitor] cordova-plugin-inappbrowser@5.0.0
[capacitor] cordova-plugin-network-information@3.0.0
[capacitor] cordova-plugin-screen-orientation@3.0.2
[capacitor] es6-promise-plugin@4.2.2
[capacitor] :heavy_check_mark: copy ios in 523.04ms
[capacitor] :heavy_check_mark: Updating iOS plugins in 15.52ms
[capacitor] [info] Found 18 Capacitor plugins for ios:
[capacitor] @capacitor/action-sheet@4.0.1
[capacitor] @capacitor/app@4.0.1
[capacitor] @capacitor/app-launcher@4.0.1
[capacitor] @capacitor/browser@4.0.1
[capacitor] @capacitor/camera@4.0.1
[capacitor] @capacitor/device@4.0.1
[capacitor] @capacitor/dialog@4.0.1
[capacitor] @capacitor/filesystem@4.0.1
[capacitor] @capacitor/geolocation@4.0.1
[capacitor] @capacitor/haptics@4.0.1
[capacitor] @capacitor/keyboard@4.0.1
[capacitor] @capacitor/local-notifications@4.0.1
[capacitor] @capacitor/network@4.0.1
[capacitor] @capacitor/preferences@4.0.1
[capacitor] @capacitor/push-notifications@4.0.1
[capacitor] @capacitor/splash-screen@4.0.1
[capacitor] @capacitor/status-bar@4.0.1
[capacitor] @capacitor/toast@4.0.1
[capacitor] [info] Found 12 Cordova plugins for ios:
[capacitor] cordova-launch-review@4.0.1
[capacitor] cordova-plugin-advanced-http@3.2.2
[capacitor] cordova-plugin-app-version@0.1.13
[capacitor] cordova-plugin-device@2.0.3
[capacitor] cordova-plugin-document-viewer@1.0.0
[capacitor] cordova-plugin-file@6.0.2
[capacitor] cordova-plugin-file-opener2@3.0.5
[capacitor] cordova-plugin-fingerprint-aio@5.0.1
[capacitor] cordova-plugin-inappbrowser@5.0.0
[capacitor] cordova-plugin-network-information@3.0.0
[capacitor] cordova-plugin-screen-orientation@3.0.2
[capacitor] es6-promise-plugin@4.2.2
[capacitor] :heavy_multiplication_x: Updating iOS native dependencies with pod install - failed!
[capacitor] :heavy_multiplication_x: update ios - failed!
[capacitor] [error] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin22/rbconfig.rb:21: warning: Insecure world writable dir /Users/diezsoftware/Desktop/Proyectos/DiezSoftware.AsesorMovil in PATH, mode 040777
[capacitor] /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:439:in help!': [!] You cannot run CocoaPods as root. (CLAide::Help) [capacitor] [capacitor] Usage: [capacitor] [capacitor] $ pod COMMAND [capacitor] [capacitor] CocoaPods, the Cocoa library package manager. [capacitor] [capacitor] Commands: [capacitor] [capacitor] + cache Manipulate the CocoaPods cache [capacitor] + env Display pod environment [capacitor] + init Generate a Podfile for the current directory [capacitor] + install Install project dependencies according to versions from a [capacitor] Podfile.lock [capacitor] + ipc Inter-process communication [capacitor] + lib Develop pods [capacitor] + list List pods [capacitor] + outdated Show outdated project dependencies [capacitor] + repo Manage spec-repositories [capacitor] + setup Set up the CocoaPods environment [capacitor] + spec Manage pod specs [capacitor] + update Update outdated project dependencies and create new Podfile.lock [capacitor] [capacitor] Options: [capacitor] [capacitor] --allow-root Allows CocoaPods to run as root [capacitor] --silent Show nothing [capacitor] --version Show the version of the tool [capacitor] --verbose Show more debugging information [capacitor] --no-ansi Show output without ANSI codes [capacitor] --help Show help banner of specified command [capacitor] from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:102:in ensure_not_root_or_allowed!’
[capacitor] from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:48:in run' [capacitor] from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.12.1/bin/pod:55:in <top (required)>’
[capacitor] from /usr/local/bin/pod:23:in load' [capacitor] from /usr/local/bin/pod:23:in
[capacitor]
[ERROR] An error occurred while running subprocess capacitor.

    capacitor add ios exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

It’s totally a madness situation. I can’t figure out what the heck wants my MAC from me to do…

When i started using mac, I came across this error a lot until i came across a video on how to setup ionic development using homebrew. Apparently if you use sudo when developing some subdirectories wont have permissions to access certain things. So i always setup mac not to require sudo when i develop ionic projects. not sure if am allowed to share link but it was a video on youtube by codeswag he explains it well. It works for me

1 Like

if you can share how to setup this… it will do my work much easier can u send me a mail with all this information? pls… ortaprogram@outlook.es

So i always setup mac not to require sudo when i develop ionic projects. MOST interesting part by far pfff

If you follow the Capacitor environment-setup docs you shouldn’t need sudo.
For not needing sudo for node/npm it recommends using volta or homebrew for managing nodejs versions (I personally prefer nvm and I’ve seen homebrew installed nodejs to have some problems)

For not needing sudo for installing cocoapods it recommends using homebrew, which also prevents some problems cocoapods have on Apple Silicon computers.

1 Like

i think you made some operation with the sudo command.
do this:
sudo chmod- R 777 ‘/Users/diezsoftware/Desktop/Proyectos/DiezSoftware.AsesorMovil/AsesorMovil_2/node_modules/'
now you should be able to run it.

if this doesn’t work, just execute the npm commnads with sudo