An error occurred while running subprocess capacitor

Hi,

Unable to perform ionic cap sync:

[capacitor] :heavy_multiplication_x: Updating iOS native dependencies with pod install - failed!
[capacitor] :heavy_multiplication_x: update ios - failed!
[capacitor] [error] /usr/local/Cellar/cocoapods/1.15.2/libexec/gems/claide-1.1.0/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)

Thanks

are you using sudo on the capacitor commands or used sudo to install npm packages?

If so, don’t

When I don’ use sudo :

ionic cap sync

ng run app:build
⠋ Generating browser application bundles (phase: setup)…An unhandled exception occurred: EACCES: permission denied, rmdir

See “/private/var/folders/vy/06f232jd7_v1b_4lk6fs9dhc0000gn/T/ng-2yZMyR/angular-errors.log” for further details.
[ERROR] An error occurred while running subprocess ng.

    ng run app:build exited with exit code 127.

You have to fix your npm permissions, you should never use sudo to run npm commands.

Check Resolving EACCES permissions errors when installing packages globally | npm Docs

But I would recommend using some node manager like nvm that allows to install multiple node versions and switch from them and they don’t present permission problems.

I try this but still the same

spoijt@MacBook-Air-de-Geraldine-4 gastonShopBack % nvm use 18
Now using node v18.20.1 (npm v10.5.0)
spoijt@MacBook-Air-de-Geraldine-4 gastonShopBack % ionic cap sync

ng run app:build
⠋ Generating browser application bundles (phase: setup)…An unhandled exception occurred: EACCES: permission denied, rmdir ‘/Users/spoijt/Documents/gaston_back/gastonShopBack/www/assets’
See “/private/var/folders/vy/06f232jd7_v1b_4lk6fs9dhc0000gn/T/ng-sOOYfH/angular-errors.log” for further details.
[ERROR] An error occurred while running subprocess ng.

    ng run app:build exited with exit code 127.
    
    Re-running this command with the --verbose flag may provide more information.

As you created the app with sudo the permissions are broken for it even if you switch to nvm, you’ll have to fix the permissions on the app or create a new one and move the code

Remove ios and add it again. There will be no access issues. I used the shortcut provided by the vscode plugin and the output is as follows

[Ionic] Add iOS...
> npm install @capacitor/ios@6.0.0 --save-exact 
up to date, audited 1229 packages in 4s
206 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities
[Ionic] Add iOS...
> npx cap add ios
✔ Adding native Xcode project in ios in 25.19ms
✔ add in 25.52ms
✔ Copying web assets from browser to ios/App/App/public in 60.47ms
✔ Creating capacitor.config.json in ios/App/App in 5.22ms
✔ copy ios in 126.53ms
✔ Updating iOS plugins in 7.05ms

After that, sync iOS is no problem