Issue in adding iOS project when installing cordova-plugin-fcm-with-dependecy-updated

Hello guys,

I have an issue in adding iOS project in ionic 4

Steps to reproduce:

  • Create Project with ionic start command
  • Adding both Platforms iOS and Android using Cordova add platform command
  • than adding plugin to implement push notification through Ionic Guide using this command sudo ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated

For android its executing successfully but for iOS its not.
please check below details for more details.

Any one please help me to get out of this issue.

ionic info


Ionic CLI : 5.4.13 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.11.7
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.3.20
@ionic/angular-toolkit : 2.1.1


Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0, ios 5.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 9 other plugins)


cordova-res : 0.8.1
native-run (update available: 0.3.0) : 0.2.9


Android SDK Tools : 26.1.1 (/Users/jalpashah/Library/Android/sdk/)
ios-deploy : 1.9.2
ios-sim : 8.0.2
NodeJS : v10.16.3 (/usr/local/bin/node)
npm : 6.13.1
OS : macOS Catalina
Xcode : Xcode 11.3 Build version 11C29

Error Logs:

Installing “cordova-plugin-fcm-with-dependecy-updated” for ios
Failed to install ‘cordova-plugin-fcm-with-dependecy-updated’: undefined
CordovaError: Promise rejected with non-error: ‘/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:439:in help!\': \u001b[31m[!] You cannot run CocoaPods as root.\u001b[39m (CLAide::Help)\n\n\u001b[4mUsage:\u001b[24m\n\n $ \u001b[32mpod\u001b[39m \u001b[32mCOMMAND\u001b[39m\n\n CocoaPods, the Cocoa library package manager.\n\n\u001b[4mCommands:\u001b[24m\n\n \u001b[32m+ cache\u001b[39m Manipulate the CocoaPods cache\n \u001b[32m+ env\u001b[39m Display pod environment\n \u001b[32m+ init\u001b[39m Generate a Podfile for the current directory\n \u001b[32m+ install\u001b[39m Install project dependencies according to versions from a\n Podfile.lock\n \u001b[32m+ ipc\u001b[39m Inter-process communication\n \u001b[32m+ lib\u001b[39m Develop pods\n \u001b[32m+ list\u001b[39m List pods\n \u001b[32m+ outdated\u001b[39m Show outdated project dependencies\n \u001b[32m+ repo\u001b[39m Manage spec-repositories\n \u001b[32m+ setup\u001b[39m Setup the CocoaPods environment\n \u001b[32m+ spec\u001b[39m Manage pod specs\n \u001b[32m+ update\u001b[39m Update outdated project dependencies and create new Podfile.lock\n\n\u001b[4mOptions:\u001b[24m\n\n \u001b[34m--silent\u001b[39m Show nothing\n \u001b[34m--version\u001b[39m Show the version of the tool\n \u001b[34m--verbose\u001b[39m Show more debugging information\n \u001b[34m--no-ansi\u001b[39m Show output without ANSI codes\n \u001b[34m--help\u001b[39m Show help banner of specified command\n\tfrom /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:47:in run’\n\tfrom /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in <top (required)>\'\n\tfrom /usr/local/bin/pod:23:in load’\n\tfrom /usr/local/bin/pod:23:in `’\n’
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:29:15)
at process._tickCallback (internal/process/next_tick.js:68:7)

Hi, I have the same error, could you solve it? Thanks a lot

Never use sudo when working with Ionic. Period.

try to remove both android and iOS and recreate both without using sudo command. and add all required plugins without sudo command until npm gives error about permission.
still issue persist after above steps.
create new project without sudo command and perform same steps above.

Note: Do not use sudo command in whole operation until you got error about permission issue.