语法错误:意外的令牌M(从Visual Studio 2015运行cordova项目时) [英] SyntaxError: Unexpected token M (when running cordova project from Visual Studio 2015)

查看:1975
本文介绍了语法错误:意外的令牌M(从Visual Studio 2015运行cordova项目时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用Visual Studio 2015使用远程设备运行我的Cordova应用程序,我得到一个错误语法错误:意外的令牌M。 Visual Studio安装在Windows 10上,这是我Mac上的Parallels VM。我已按照步骤在我的Mac上设置remotebuild。从Visual Studio - 工具 - 选项,我可以成功地连接到我的mac上运行的remotebuild。当我在chrome中使用Ripple运行它时,该项目运行良好。

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.

这里有一些背景。当我第一次开始工作这个项目,它是工作正常,我能够在我的Mac上的iOS模拟器上运行它。有一点,它开始给我一个不同的错误,这是与我的iOS开发者帐户有关。我在我的Mac上打开Xcode,意识到我需要登录到开发人员网站并接受最新的许可协议。一旦我这样做,我试图从Visual Studio中再次运行该项目。在那一刻,我看到一个与证书相关的错误。我再次运行项目,从那时我继续得到这个语法错误:意外的令牌M错误。

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

这是输出日志的一部分, SyntaxError:Unexpected token M:

Here's the part of the output log where I see the "SyntaxError: Unexpected token M":

1>  ------    changeList.deletedFilesIos:  (TaskId:11)
1>  ------    changeList.addedPluginsIos: org.apache.cordova.camera@0.3.6,org.apache.cordova.file-transfer@0.5.0,org.apache.cordova.splashscreen@1.0.0,org.apache.cordova.inappbrowser@0.6.0 (TaskId:11)
1>  ------    changeList.deletedPluginsIos:  (TaskId:11)
1>  ------    changeList.addedPlugins: org.apache.cordova.camera@0.3.6,org.apache.cordova.file-transfer@0.5.0,org.apache.cordova.splashscreen@1.0.0,org.apache.cordova.inappbrowser@0.6.0 (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!!!

幸运的是,我有一个旧的备份我的项目,当在远程设备上运行它不产生语法错误:意外的令牌M。我使用比较工具来查看文件/文件夹的差异。原来,位于插件文件夹中的remote_ios.json文件已损坏。我删除它,在下一次运行它生成一个适当的一个,一切现在工作正如预期。我可以部署到我的Mac上的iOS模拟器以及我的iPhone。

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.

我没有注意到文件被损坏了几次。所以每次我只是删除了文件,它被重新创建,一切工作。听起来像是Visual Studio 2015中的错误。

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.

这里是我损坏的remote_os.json文件的样子:

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

这篇关于语法错误:意外的令牌M(从Visual Studio 2015运行cordova项目时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆