The ios simulator on cordova does not work

When running the command

cordova emulate ios 

I get an error as shown below. I really get rm: could not remove and permission denied errors, so I use sudo. I was able to run this without problems, and then after rebooting - although nothing has changed - this function does not work. After build succeeded - deploying to emulator I get this error

  An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159): Invalid device state ENOENT: no such file or directory, stat '/Users/user/Library/Logs/CoreSimulator/8F3C9A0F-D432-49A4-84DA-D0480829884A/system.log' Error code 1 for command: ios-sim with args: launch,/Users/user/helloworld/platforms/ios/build/emulator/helloworld.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-4s,--stderr,/Users/user/helloworld/platforms/ios/cordova/console.log,--stdout,/Users/user/helloworld/platforms/ios/cordova/console.log,--exit Error: /Users/user/helloworld/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:139:23) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:818:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) 

I reinstalled sudo npm install ios-sim -g and the same error. How can I run it correctly?

+8
ios macos cordova-3
source share
3 answers

This is due to permissions on mac:

Following are the steps you can fix:

Empty the platforms platform in the Cordoba project.

Re-run Cordova platform add ios , Cordova build ios and Cordova emulate ios without sudo .

If you are on a Mac and still get a permission error, make sure that all the files in the user's home folder really belong to this user by running sudo chown -R username /Users/username

+15
source share

This happens when you do not have simulator configurations for the root user.

The following command worked for me: sudo npm install -g iso-sim

If it does not work, you can try to remove the platforms as the root user and add it as a regular user.

0
source share

This is because the xcode command line tools are not installed on your system https://github.com/driftyco/ionic/issues/4657 . Make xcode-select -install from your terminal and reboot the system so that it works fine.

-one
source share

All Articles