ios-control / ios-sim

Command-line application launcher for the iOS Simulator
Apache License 2.0
1.5k stars 253 forks source link

Running "ios-sim showdevicetypes" throws error "Cannot read property 'replace' of undefined" #203

Closed alexfoxy closed 7 years ago

alexfoxy commented 7 years ago

I'm having problems running the command "ios-sim showdevicetypes" from the terminal. The problem points to simctl.list() throwing an error however if I run simctl stand alone in a node shell it returns a reasonable list of device simulators: https://gist.github.com/alexfoxy/998ad605cf42734bdc5c40231e3cadce

I discovered this issue whilst running cordova run ios.

System Specs

shazron commented 7 years ago

Ugh. I can't repro this on my system but I think I know where these happen. If you have the error stacktrace that would help.

alexfoxy commented 7 years ago

Here's the full stack:

Error: TypeError: Cannot read property 'replace' of undefined
    at remove (/Users/alexfox/amplify/krft/platforms/ios/cordova/node_modules/ios-sim/src/lib.js:282:70)
    at Array.forEach (native)
    at Object.lib.getdevicetypes (/Users/alexfox/amplify/krft/platforms/ios/cordova/node_modules/ios-sim/src/lib.js:292:22)
    at Object.listEmulatorImages [as run] (/Users/alexfox/amplify/krft/platforms/ios/cordova/lib/list-emulator-images:36:29)
    at deployToSim (/Users/alexfox/amplify/krft/platforms/ios/cordova/lib/run.js:146:50)
    at /Users/alexfox/amplify/krft/platforms/ios/cordova/lib/run.js:88:20
    at _fulfilled (/Users/alexfox/amplify/krft/platforms/ios/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/alexfox/amplify/krft/platforms/ios/cordova/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/Users/alexfox/amplify/krft/platforms/ios/cordova/node_modules/q/q.js:796:13)
    at /Users/alexfox/amplify/krft/platforms/ios/cordova/node_modules/q/q.js:604:44
shazron commented 7 years ago

One last thing, node --version?

alexfoxy commented 7 years ago

v6.1.0

shazron commented 7 years ago

Published 5.0.13 - https://github.com/phonegap/ios-sim/releases/tag/5.0.13

alexfoxy commented 7 years ago

Thanks!

sebastianstrus commented 7 years ago

Thanks!

sultan-arshi commented 4 years ago

+1 I am getting same error Can any one explain, how to resolve this issue ? I just want to send my .app file to facebook review and this command is not working ! I am getting same error when rung any command

shubhamk1997 commented 4 years ago

Facing the same issue

TypeError: Cannot read property 'devicetypes' of undefined at fixSimCtlList (~/.nvm/versions/node/v12.14.1/lib/node_modules/ios-sim/src/helpers.js:12:38) at getDeviceTypes (~/.nvm/versions/node/v12.14.1/lib/node_modules/ios-sim/src/helpers.js:30:10) at ShowDeviceTypesCommand.run (~/.nvm/versions/node/v12.14.1/lib/node_modules/ios-sim/src/commands/showdevicetypes.js:7:25)

Has this been resolved yet ?

saurabh948 commented 4 years ago

Set command line tool version from your Xcode preferences. It worked for me

miligithub commented 3 years ago

You might need to print-path and make sure Xcode is being used and NOT Command Line Tools.

$ xcode-select --print-path
/Library/Developer/CommandLineTools
$ sudo xcode-select -s /Applications

Now do print-path again and you would see

$ xcode-select --print-path 
/Applications/Xcode.app/Contents/Developer