ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: Ionic emulate Ios fails to run The session does not open my app

Open YonasBerhe opened this issue 11 years ago • 29 comments

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)

YonasBerhe avatar Jul 07 '15 22:07 YonasBerhe

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.

iamthemovie avatar Jul 12 '15 22:07 iamthemovie

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?

bferreirainfo avatar Jul 17 '15 21:07 bferreirainfo

It's because you created the ionic project using Sudo.

iamthemovie avatar Jul 17 '15 21:07 iamthemovie

Recursively chown that folder to your user.

iamthemovie avatar Jul 17 '15 21:07 iamthemovie

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 =)

bferreirainfo avatar Jul 18 '15 02:07 bferreirainfo

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

bferreirainfo avatar Jul 18 '15 13:07 bferreirainfo

Indeed it was a permission issue thanks @iamthemovie

code4jhon avatar Aug 05 '15 22:08 code4jhon

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

var1ableX avatar Sep 13 '15 15:09 var1ableX

amazing !!!!! it work for me

lionel22 avatar Sep 23 '15 20:09 lionel22

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

mhartington avatar Sep 23 '15 20:09 mhartington

Worked like a charm. Indeed it was a permission problem.

zamankazi avatar Oct 21 '15 15:10 zamankazi

@rajkotecha Thx, you save my day!

liuwenzhuang avatar Nov 09 '15 03:11 liuwenzhuang

@rajkotecha's fix also worked for me.

zvineyard avatar Nov 17 '15 22:11 zvineyard

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 avatar Nov 23 '15 22:11 craigm26

craigm26 sudo chown -Rv [USERNAME] /Users/[USERNAME] - helped me!

dimkk avatar Nov 29 '15 03:11 dimkk

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

mlynch avatar Dec 07 '15 04:12 mlynch

Thanks guys/gals

craigm26 avatar Dec 07 '15 04:12 craigm26

sudo chown -Rv [USERNAME] /Users/[USERNAME] helped me too!

ifelere avatar Dec 11 '15 13:12 ifelere

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

vallal7 avatar Dec 14 '15 19:12 vallal7

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

carbondesign avatar Dec 30 '15 20:12 carbondesign