GithubHelp home page GithubHelp logo

Comments (13)

tzmartin avatar tzmartin commented on June 26, 2024 4

simctl.js
LN 175: Change obj.output to obj.stdout

from simctl.

mrister avatar mrister commented on June 26, 2024 1

@CodeWithOz unfortunately no, I had to resort to using xcrun simctl list devices and xcrun simctl boot to run the simulator

from simctl.

antares-farias avatar antares-farias commented on June 26, 2024 1

what works for me was to directly install in the project the previews version of the simctl

npm install [email protected]

from simctl.

mrister avatar mrister commented on June 26, 2024

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.

CodeWithOz avatar CodeWithOz commented on June 26, 2024

@mrister have you found a workaround for now?

from simctl.

ezilox avatar ezilox commented on June 26, 2024

Also experience the same issue :(

from simctl.

radykal avatar radykal commented on June 26, 2024

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.

mrister avatar mrister commented on June 26, 2024

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.

XtoZee avatar XtoZee commented on June 26, 2024

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.

mrister avatar mrister commented on June 26, 2024

@shazron @marekkalnik can anybody of you perhaps implement a fix, this is breaking.

from simctl.

marekkalnik avatar marekkalnik commented on June 26, 2024

Sorry @mrister I have not been using this project since 2015, not much I can do to help :(

from simctl.

airdrummingfool avatar airdrummingfool commented on June 26, 2024

@shazron I've opened a PR (#31), please take a look. Thanks @tzmartin for the fix suggestion.

from simctl.

airdrummingfool avatar airdrummingfool commented on June 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.