Comments (13)
simctl.js
LN 175: Change obj.output
to obj.stdout
from simctl.
@CodeWithOz unfortunately no, I had to resort to using xcrun simctl list devices
and xcrun simctl boot
to run the simulator
from simctl.
what works for me was to directly install in the project the previews version of the simctl
npm install [email protected]
from simctl.
seem to be having the same issue also!
+ npm install ios-sim -g
/Users/vagrant/.nvm/versions/node/v14.18.2/bin/ios-sim -> /Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/bin/ios-sim
+ [email protected]
added 117 packages from 78 contributors in 7.873s
+ xcode-select --print-path
/Applications/Xcode-13.1.Release.Candidate.app/Contents/Developer
+ ios-sim showsdks
+ true
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.list (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/node_modules/simctl/simctl.js:171:33)
at ShowSdksCommand.run (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/src/commands/showsdks.js:7:25)
at ShowSdksCommand._run (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/node_modules/@oclif/command/lib/command.js:43:31)
TypeError: Cannot read property 'runtimes' of undefined
+ ios-sim showdevicetypes
+ true
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.list (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/node_modules/simctl/simctl.js:171:33)
at getDeviceTypes (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/src/helpers.js:29:21)
at ShowDeviceTypesCommand.run (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/src/commands/showdevicetypes.js:7:25)
at ShowDeviceTypesCommand._run (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/node_modules/@oclif/command/lib/command.js:43:31)
TypeError: Cannot read property 'devicetypes' of undefined
+ ios-sim start -d iPhone-12-Pro -x
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.list (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/node_modules/simctl/simctl.js:171:33)
at getDeviceFromDeviceTypeId (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/src/helpers.js:196:21)
at StartCommand.run (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/src/commands/start.js:10:20)
at StartCommand._run (/Users/vagrant/.nvm/versions/node/v14.18.2/lib/node_modules/ios-sim/node_modules/@oclif/command/lib/command.js:43:31)
TypeError: Cannot read property 'devicetypes' of undefined
from simctl.
@mrister have you found a workaround for now?
from simctl.
Also experience the same issue :(
from simctl.
I got the same issue using Cordova in Meteor. I created two meteor projects with cordova. In the first one it is working, but in the other project with the same env I got the same error as mentioned above. Now I debugged the code and it seems there is a problem with the async shell execution.
I pasted an sync call after line 166 in the code and detect that the correct output is stored in the stdout of the callback function.
var command = util.format('xcrun simctl list %s --json', sublist);
var obj = shell.exec(command, { silent: options.silent });
shell.exec(command, { silent: options.silent }, (code, stdout, stderr) => {
console.log('Exit code:', code);
console.log('Program output:', stdout);
console.log('Program stderr:', stderr);
});
if (obj.code === 0) {
try {
obj.json = obj.output ? JSON.parse(obj.output) : JSON.parse(obj.stdout);
} catch (err) {
console.error(err.stack);
}
}
from simctl.
I got the same issue using Cordova in Meteor. I created two meteor projects with cordova. In the first one it is working, but in the other project with the same env I got the same error as mentioned above. Now I debugged the code and it seems there is a problem with the async shell execution.
I pasted an sync call after line 166 in the code and detect that the correct output is stored in the stdout of the callback function.
var command = util.format('xcrun simctl list %s --json', sublist); var obj = shell.exec(command, { silent: options.silent }); shell.exec(command, { silent: options.silent }, (code, stdout, stderr) => { console.log('Exit code:', code); console.log('Program output:', stdout); console.log('Program stderr:', stderr); }); if (obj.code === 0) { try { obj.json = obj.output ? JSON.parse(obj.output) : JSON.parse(obj.stdout); } catch (err) { console.error(err.stack); } }
@radykal how bout a PR since this breaking change does not seem to get the attention of maintainer(s) here
from simctl.
what works for me was to directly install in the project the previews version of the simctl
npm install [email protected]
Worked for me as a temporary solution.
Could not run Cordova 10 app in simulator. Got error on "Deploing to simulator" phase. (XCode 12.4, node v14.7.0, cordova-ios 6.2.0)
Error: Unhandled error. ('[ios-sim] SyntaxError: Unexpected token u in JSON at position 0
from simctl.
@shazron @marekkalnik can anybody of you perhaps implement a fix, this is breaking.
from simctl.
Sorry @mrister I have not been using this project since 2015, not much I can do to help :(
from simctl.
@shazron I've opened a PR (#31), please take a look. Thanks @tzmartin for the fix suggestion.
from simctl.
Sorry all, my original PR missed a couple of usages of output
, so I've opened another (#32).
That will fix [ios-sim] Unable to parse xcodebuild version.
in case anyone is seeing that.
/cc @shazron
from simctl.
Related Issues (20)
- Reverse the check for Simulator app HOT 1
- Does not handle "iPad Pro (9.7 inch)" and "iPad Pro (12.9 inch)" in listing devices
- omg - use `xcrun simctl list --json` HOT 1
- Does not handle 'iPad Pro (12.9-inch) (2nd generation)' HOT 1
- xcrun instruments can't launch Simulators on Xcode 9 HOT 7
- [1.1.x & Xcode9] start extension restarts simulator if already running HOT 8
- Wrong error message
- How to open the device window? HOT 1
- Update shelljs to 0.8.5 to resolve npm audit security vulnerability HOT 1
- unable to get device details, possibly due to shelljs update
- Support "== Device Pairs ==" in "simctl list" HOT 1
- add non-mocked shelljs test
- add npmjs badge and npmjs downloads badge
- get 100% code coverage
- Support "simctl pair" command
- Support "simctl unpair" command
- Support "simctl get_app_container" command
- 'Invalid Device State' error HOT 1
- simctl.extensions.start fails to start new simulator if simulator with different deviceId is already running HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simctl.