简体   繁体   English

创建Cordova App Visual Studio 2015构建错误

[英]Creating Cordova App Visual Studio 2015 Build Errors

I thought I would try to build a cordova app with Visual Studio 2015, I normally use different IDEs for this (intellij and Netbeans) without any problems but fancied trying a new tool (as I do use VS for some web apps). 我以为我会尝试使用Visual Studio 2015构建Cordova应用程序,为此我通常使用不同的IDE(intellij和Netbeans),不会出现任何问题,但是却想尝试一种新工具(因为我对某些Web应用程序确实使用VS)。

I have installed VS2015 Community and installed with the cordova tooling. 我已经安装了VS2015社区并安装了cordova工具。

I thought I would do a test with the defaults and run, but I get build errors as per screen shot 我以为我会使用默认设置进行测试并运行,但是按屏幕截图我会遇到构建错误

在此处输入图片说明

Not sure what its on about..... If I run VS 2015 as administrator ( shortcut option - even though my user account is admin - nice one windows), I still get a build issue but no errors reported , anyone else experienced this ? 不知道它是怎么回事.....如果我以管理员身份运行VS 2015(快捷方式选项-即使我的用户帐户是admin-一个不错的Windows),我仍然会遇到生成问题,但没有错误报告,其他人都会遇到这种情况?

Running as Admin this is what screens look like for a blank cordova app 以管理员身份运行,这是空白Cordova应用程序的屏幕外观

在此处输入图片说明

which I enabled by setting shortcut 我通过设置快捷方式启用了

在此处输入图片说明

As suggested above by @DeanB_Develop I looked at the output. 正如上面@DeanB_Develop所建议的那样,我查看了输出。 which for interest is as follows; 利息如下:

    All packages are already installed and there is nothing to restore.
    NuGet package restore finished.
    1>------ Build started: Project: BlankCordovaApp2, Configuration: Debug Android ------
    1>  Your environment has been set up for using Node.js 0.10.35 (x64) and npm.
    1>  ------ Ensuring correct global installation of package from source package directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac
    1>  ------ Name from source package.json: vs-tac
    1>  ------ Version from source package.json: 0.2.19
    1>  ------ Package not currently installed globally.
    1>  ------ Installing globally from source package. This could take a few minutes...
    1>  npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"0.10.35","npm":"2.1.5"})
    1>  C:\Program Files (x86)\nodejs\vs-tac-cli -> C:\Program Files (x86)\nodejs\node_modules\vs-tac\vs-tac-cli.cmd
    1>  vs-tac@0.2.19 C:\Program Files (x86)\nodejs\node_modules\vs-tac
    1>  ├── rimraf@2.2.6
    1>  ├── ncp@0.5.1
    1>  ├── mkdirp@0.3.5
    1>  ├── q@1.0.1
    1>  ├── semver@2.3.1
    1>  ├── adm-zip@0.4.4
    1>  ├── fstream@0.1.28 (inherits@2.0.1, graceful-fs@3.0.6)
    1>  ├── elementtree@0.1.6 (sax@0.3.5)
    1>  ├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.10)
    1>  ├── tar@0.1.20 (inherits@2.0.1, block-stream@0.0.7)
    1>  ├── request@2.36.0 (json-stringify-safe@5.0.0, qs@0.6.6, forever-agent@0.5.2, aws-sign2@0.5.0, oauth-sign@0.3.0, tunnel-agent@0.4.0, mime@1.2.11, node-uuid@1.4.3, tough-cookie@1.1.0, http-signature@0.10.1, hawk@1.0.0, form-data@0.1.4)
    1>  ├── ripple-emulator@0.9.28 (connect-xcors@0.5.2, colors@0.6.0-1, open@0.0.3, accounting@0.4.1, request@2.12.0, moment@1.7.2, express@3.1.0)
    1>  └── plugman@0.22.4 (q@0.9.7, underscore@1.4.4, nopt@1.0.10, rc@0.3.0, npm@1.3.4, cordova-lib@0.21.6)
    1>  ------ npm install failed. Exit code: 0
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    ========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

The only thing I could see was a npm WARN but not sure if this was causing the problem. 我唯一能看到的是npm WARN,但不确定这是否引起了问题。

So I visited the following page after googling that shows the tools that can be installed independatly https://msdn.microsoft.com/en-au/library/dn771551.aspx 因此,在谷歌搜索后访问了以下页面,该页面显示了可以独立安装的工具https://msdn.microsoft.com/zh-cn/library/dn771551.aspx

The only thing that stood out was 'Ant'. 唯一引人注目的是“蚂蚁”。 I currently have it installed but its WinAnt living in my Program files. 我目前已安装它,但其WinAnt位于我的程序文件中。 I did choose the option for Ant when installing the cordova tools so not sure what happened to that- maybe my winant scared it off... 我在安装cordova工具时确实选择了Ant选件,所以不确定那是怎么回事-也许我的winant害怕了...

I downloaded the version from that page and extracted it to a folder c:\\apache-ant-xxx 我从该页面下载了版本,并将其解压缩到文件夹c:\\ apache-ant-xxx

Then updated the ANT_HOME environment variable to point to the new folder rather than WinAnt and also added the new folder path to the system path. 然后更新ANT_HOME环境变量,使其指向新文件夹而不是WinAnt,并且还将新文件夹路径添加到系统路径。

Then loaded Visual studio again and run the project. 然后再次加载Visual Studio并运行该项目。

工作项目示例

Yay it works, now to start doing some actual work :). 是的,它可以工作,现在开始做一些实际的工作:)。

Check the output window after your build. 构建后检查输出窗口。 This will provide much more detailed information. 这将提供更多详细信息。 You can access the output window: 您可以访问输出窗口:

View > Output 查看>输出

or 要么

CTRL + W, O CTRL + W,O

In the "Show output from:" drop down, select "build" 在“显示以下来源的输出:”下拉列表中,选择“构建”

When you initially installed VS 2015, did you choose to install the "Common Tools and Software Development..." feature. 最初安装VS 2015时,是否选择安装“通用工具和软件开发...”功能。 If not, go to Windows' Add/Remove programs in the Control Panel, and choose to modify the VS 2015 installation and checkmark it. 如果没有,请转到“控制面板”中Windows的“添加/删除程序”,然后选择修改VS 2015安装并选中它。 Hope this helps. 希望这可以帮助。

VS 2015 RC安装的屏幕截图

Download APACHE ANT and extract it to a folder c:\\apache-ant-xxx Then updated the ANT_HOME environment variable to point to the new folder (rather than WinAnt) and add the new folder path to the system path. 下载APACHE ANT并将其解压缩到文件夹c:\\ apache-ant-xxx,然后更新ANT_HOME环境变量以指向新文件夹(而不是WinAnt),并将新文件夹路径添加到系统路径。 ;) ;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM