Sudo ionic cordova platfrom add ios Problem

hello all .

this problem face me when run

sudo ionic cordova platform add ios

any help please . i was searching but no soluations .

Looks like an issue with Facebook plugin. Remove it, install the platform, then add the plugin. Also check the plugin’s github for any known issues

Also, never ever use sudo during Ionic development. There is absolutely no reason to do so, and doing it even once is likely to h0rk up file permissions very badly.

thank you for replying
Sorry, I am new to work on the Mac system.
I tried to do this, but the problem is as follows:

macs******@example  sezar-app %  ionic cordova platform add ios      
Error: EACCES: permission denied, open '/Users/someOne/.ionic/config.json.3849011949'

at Object.openSync (fs.js:462:3)
at Function.writeFileSync [as sync]
at Config._setFile (/usr/local/lib/node_modules/@ionic/cli/node_modules/@ionic/cli-framework/lib/config.js:66:25)
at Config.set c [as c] (/usr/local/lib/node_modules/@ionic/cli/node_modules/@ionic/cli-framework/lib/config.js:41:14)
at Config.set (/usr/local/lib/node_modules/@ionic/cli/node_modules/@ionic/cli-framework/lib/config.js:53:16)
at (/usr/local/lib/node_modules/@ionic/cli/index.js:100:21)

Exactly. You used sudo once, and now the file permissions are all messed up. You need to use chown to get things owned by a regular user. Immediately install nvm and use it to manage your node installations.

Thank you for your reply
But my knowledge of the nvm is simple. I think that I have a weak understanding of protection in the Mac system.
Now I have researched a lot and learned about many of the concepts of access permissions. I reached the next solution, I do not know if this solution is perfect, but the problem no longer exists.
I do this >>>>>

macshop@Macs-Mac-Pro sezar-app % ls -l  /Users/macshop/.ionic  

-rw-r--r--  1 root     staff  131     Sep. 4 01:38      config.json
-rw-r--r--  1 root     staff  10174 Sep  2 19:08      helper.log
-rw-r--r--  1 root     staff    312   Sep  3 18:23      update.json

as you see all of this files has a root account permissions
so i run this command to set this permissions to macshop user

macshop@Macs-Mac-Pro sezar-app % sudo chown macshop /Users/macshop/.ionic/update.json
macshop@Macs-Mac-Pro sezar-app % sudo chown macshop /Users/macshop/.ionic/helper.log 
macshop@Macs-Mac-Pro sezar-app % sudo chown macshop /Users/macshop/.ionic/config.json

after that >>>>>>

macshop@Macs-Mac-Pro sezar-app % ionic s
> ng run app:serve --host=localhost --port=8100

its run correctly
Kindly give me your opinion

That sounds like a reasonable way of fixing things. Now hopefully you can just avoid using sudo in the future.

thank you for your time