bug: Ionic emulate Ios fails to run The session does not open my app
Type: bug
Platform: ios 7 browser
Ionic emulate ios failed on Mac OS Yosemite. Their have some cases were the ios device emulated, but shortly after the terminal console shoots up the error message below.
** BUILD SUCCEEDED ** No target specified for emulator. Deploying to iPhone-6 simulator An error was encountered processing the command (code=146): Invalid device state An error was encountered processing the command (code=146): Exception encountered connecting to CoreSimulatorBridge: Unable to connect to CoreSimulatorBridge ENOENT, no such file or directory '/Users/yay/Library/Logs/CoreSimulator/2CAA2C39-7F22-4AF2-BBDE-86609188F37C/system.log' Error code 1 for command: ios-sim with args: launch,/Users/yay/code/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/yay/code/myApp/platforms/ios/cordova/console.log,--stdout,/Users/yay/code/myApp/platforms/ios/cordova/console.log,--exit Error: /Users/yay/code/myApp/platforms/ios/cordova/run: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1015:16) at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
This is a permissions issue:
running sudo ionic start requires you to build / emulate with sudo to remove/build files which won't work when emulating, hence your error.
Don't use sudo for creating or emulating.
i have that same problem, if i don't use sudo like you suggest, i get "rm: could not remove file (code EACCES):" on all files. Xcode 6.4, last node/npm. But as u say this is a sudo problem, so how to resolve this dilema?
It's because you created the ionic project using Sudo.
Recursively chown that folder to your user.
Thank you for your answer! But sorry english isn't my native languagem, i dont quite understand. My projet was created on a windowns system, with android platform, and right now i fork this project on a mac via github. There is a solution? what is "Recursively chown that folder to your user." Thank you again, my startup depend in resolve that problem =)
i tested creating a project without sudo and emulate with and without sudo, and got the same erros.
ionic start test sudo ionic platform add ios(can't go to the next step without sudo here) ionic emulate iOS: rm: could not remove file (code EACCES): sudo ionic emulate iOS: Invalid device state An error was encountered processing the command (code=146): Exception encountered connecting to CoreSimulatorBridge: Unable to connect to CoreSimulatorBridge ENOENT, no such file or directory '/Users/yay/Library/Logs/CoreSimulator/2CAA2C39-7F22-4AF2-BBDE-86609188F37C/system.log' Error
Indeed it was a permission issue thanks @iamthemovie
the following worked for me:
//remove with sudo
sudo ionic platform remove ios
//add iOS back without sudo
ionic platform add ios
//worked for me
ionic emulate ios
amazing !!!!! it work for me
So you shouldn't ever have to run the ionic command with sudo, ever. Since the cli is installed globally already, the current user has access to all it's commands. The only time this could be an issue with with nvm and not having a globally available version of node
Worked like a charm. Indeed it was a permission problem.
@rajkotecha Thx, you save my day!
@rajkotecha's fix also worked for me.
I'm having the problem but I can't seem to diagnose how to fix the permission issue.
when I do
ionic platform add ios
I get a error to fetch platform.. ...operation ont permitted, utime "somepath/package/.npmignore
Do I need to eliminate a line in this file?
craigm26 sudo chown -Rv [USERNAME] /Users/[USERNAME] - helped me!
If you're still having issues, can you post over here? https://github.com/driftyco/ionic-cli
Also, just in case, try installing the beta: npm install -g ionic@beta
Thanks guys/gals
sudo chown -Rv [USERNAME] /Users/[USERNAME] helped me too!
I had access error for update-notifier-cordova.json; and this is what that worked for me: sudo chown [USERNAME]:admin /Users/[USERNAME]/.config/configstore/update-notifier-cordova.json
to get the reomve/add mentioned above to work I had to delete the .cordova/lib/npm_cache/cordova-ios folder...then all was well