SOLVED: Unable to run Ionic commands without Sudo

When I run any ionic command without sudo I get errors. e.g when I run ionic platform add ios I get Cordova can only run in Xcode version 4.6 or greater. even though I have the most recent Xcode version installed.

However when I use sudo it works. The problem then is that I am not able to emulate. I get this error

Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x7f8cf1700fa0 {NSLocalizedDescription=Simulator session timed out.}
Error: /Users/eanjorin/Projects/neartutors-mobile/platforms/ios/cordova/run: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

How about node? Do You need to run npm with sudo also?
I think You should start by updating npm, cordova and ionic and making sure all of them run correctly without sudo.

Check out this plugin for npm running without sudo

I found a way to install cordova, and ionic without sudo. But when I run ionic platform add ios, I still get Cordova can only run in Xcode version 4.6 or greater which is not true. I suspect if I do sudo ionic platform add ios it will work, except when I try to simulate my app, it will get the same error.

Finally found the solution here!topic/phonegap/r_LWciJlPsc


1 Like