When I attempt to run my Cordova app using Visual Studio 2015 using Remote Device, I get an error "SyntaxError: Unexpected token M". Visual Studio is installed on windows 10 which is a Parallels VM on my Mac. I have followed the steps to setup remotebuild on my Mac. From Visual Studio - Tools - options, I can successfully connect to the running remotebuild on my mac. The project runs fine when I run it on Ripple in chrome.
Here's a little more background. When I first started working on this project, it was working fine and I was able to run it on the iOS simulator on my Mac. At one point, it started giving me a different error which was related to my iOS developer account. I opened up Xcode on my mac and realized that I needed to login to the developer website and accept the latest license agreement. Once I did that, I attempted to run the project again from Visual Studio. At that point I saw an error related to certificate. I ran the project again, and from then on I keep getting this "SyntaxError: Unexpected token M" error.
I attempted to run an old backup of the same project. The error I get with that is:
An error occurred uploading to the build server https://10.0.1.31:3000/cordova: Error: self signed certificate in certificate chain
Here's the part of the output log where I see the "SyntaxError: Unexpected token M":
1> ------ changeList.deletedFilesIos: (TaskId:11)
1> ------ changeList.addedPluginsIos: [email protected],[email protected],[email protected],[email protected] (TaskId:11)
1> ------ changeList.deletedPluginsIos: (TaskId:11)
1> ------ changeList.addedPlugins: [email protected],[email protected],[email protected],[email protected] (TaskId:11)
1> ------ changeList.deletedPlugins: (TaskId:11)
1> ------ Updating plugins (TaskId:11)
1> SyntaxError: Unexpected token M (TaskId:11)
1>Done executing task "MdaVsCli" -- FAILED. (TaskId:11)
1>Done building target "BuildMDA" in project "MyPyaarApp.jsproj" -- FAILED.: (TargetId:12)
1>
1>Project Performance Summary:
1> 672 ms C:\svn\mypyaar\trunk\MyPyaarApp\MyPyaarApp\MyPyaarApp.jsproj 1 calls
1> 672 ms build 1 calls
1>
1>Target Performance Summary:
1> 0 ms BuildOnlySettings 1 calls
1> 0 ms CompileTypeScript 1 calls
1> 0 ms AfterBuild 1 calls
1> 0 ms TrackJsChanges 1 calls
1> 0 ms BeforeBuild 1 calls
1> 0 ms PreComputeCompileTypeScript 1 calls
1> 0 ms CoreBuild 1 calls
1> 16 ms _CheckForInvalidConfigurationAndPlatform 1 calls
1> 266 ms EnsureNodeJsRequirementsAreAtCorrectVersion 1 calls
1> 266 ms InstallMDA 1 calls
1> 391 ms BuildMDA 1 calls
1>
1>Task Performance Summary:
1> 0 ms MdaVerifySetup 1 calls
1> 0 ms MdaTrackJsChanges 1 calls
1> 0 ms Message 2 calls
1> 0 ms VsTsc 2 calls
1> 0 ms AssignTargetPath 1 calls
1> 266 ms RunMdaInstall 1 calls
1> 266 ms CallTarget 1 calls
1> 391 ms MdaVsCli 1 calls
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.65
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
Found the solution to this!!!
Luckily I had an old backup of my project which didn't produce the "SyntaxError: Unexpected token M" when running it on the remote device. I used a compare tool to see the differences in files/folders. It turned out that the "remote_ios.json" file located in the plugins folder was corrupted. I deleted it and on the next run it generated a proper one and everything now works as expected. I can deploy to the iOS simulator on my mac as well as my iPhone.
I did notice a few more times that the file did get corrupted. So every time I just deleted the file and it got recreated and everything worked. Sounds like a bug in Visual Studio 2015.
Here's how my corrupted remote_os.json file looked like:
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {
"framework": {
"parents": {
"ImageIO.framework": [
{
"xml": true,
"count": 1
}
],
"CoreLocation.framework": [
{
"xml": false,
"count": 1
}
],
"CoreGraphics.framework": [
{
"xml": false,
"count": 4
}
],
"AssetsLibrary.framework": [
{
"xml": false,
"count": 3
}
],
"MobileCoreSe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With