SyntaxError: Unexpected token M (when running cordova project from Visual Studio 2015)

后端 未结 2 1625
暗喜
暗喜 2021-01-05 17:20

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

2条回答
  •  一向
    一向 (楼主)
    2021-01-05 17:51

    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
    

提交回复
热议问题