简体   繁体   English

Visual Studio 2015预览版 - Apache Cordova构建错误

[英]Visual Studio 2015 preview - Apache Cordova Build Error

When I am tried to build apache cordova application in Visual Studio 2015 Preview I am experiencing following error. 当我尝试在Visual Studio 2015预览版中构建apache cordova应用程序时,我遇到以下错误。

npm install error : error : spawn ENOENT

But in Command prompt if i use 但是如果我使用命令提示符

npm -v

Its returning 它的归来

2.1.9

But when visual studio trying to install npm I am getting error. 但是当visual studio尝试安装npm时,我收到了错误。

Can any one help me on this? 谁可以帮我这个事?

Thanks. 谢谢。

Hi all, 大家好,

After done the steps told by Ellen. 完成了艾伦告诉他们的步骤。 Visual Studio reported New Error message Visual Studio报告了新错误消息

1>Task "MdaVsCli" (TaskId:17)
1>  Task Parameter:VsCliPath= C:\Users\MyName\AppData\Roaming\npm\node_modules\vs-mda\vs-cli.cmd (TaskId:17)
1>  Task Parameter:Platform=Android (TaskId:17)
1>  Task Parameter:ProjectDir=. (TaskId:17)
1>  Task Parameter:Configuration=Debug (TaskId:17)
1>  Task Parameter:ProjectName=BlankCordovaApp21 (TaskId:17)
1>  Task Parameter:Language=en-US (TaskId:17)
1>  Task Parameter:BuildTarget=RippleNexus (TaskId:17)
1>  The system cannot find the path specified. (TaskId:17)
1>Done executing task "MdaVsCli" -- FAILED. (TaskId:17)

The following are the message after i had installed npm. 以下是我安装npm后的消息。

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\xxl33
z1o.sqb\packages\vs-mda>npm -g install
npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":
"0.10.33","npm":"2.1.9"})
npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":
"0.10.33","npm":"2.1.9"})
C:\usr\local\vs-cli -> C:\usr\local\node_modules\vs-mda\vs-cli.cmd
vs-mda@0.1.70 C:\usr\local\node_modules\vs-mda
├── rimraf@2.2.6
├── ncp@0.5.1
├── q@1.0.1
├── mkdirp@0.3.5
├── adm-zip@0.4.4
├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.10)
├── fstream@0.1.28 (inherits@2.0.1, graceful-fs@3.0.4)
├── tar@0.1.20 (inherits@2.0.1, block-stream@0.0.7)
├── elementtree@0.1.6 (sax@0.3.5)
├── request@2.36.0 (json-stringify-safe@5.0.0, tunnel-agent@0.4.0, forever-agent
@0.5.2, qs@0.6.6, aws-sign2@0.5.0, oauth-sign@0.3.0, mime@1.2.11, node-uuid@1.4.
1, tough-cookie@0.12.1, form-data@0.1.4, hawk@1.0.0, http-signature@0.10.0)
├── ripple-emulator@0.9.24 (connect-xcors@0.5.2, colors@0.6.0-1, open@0.0.3, acc
ounting@0.4.1, request@2.12.0, moment@1.7.2, express@3.1.0)
├── cordova@4.0.0 (q@0.9.7, underscore@1.4.4, nopt@2.2.1, cordova-lib@4.0.0)
└── plugman@0.22.4 (q@0.9.7, underscore@1.4.4, nopt@1.0.10, rc@0.3.0, cordova-li
b@0.21.6, npm@1.3.4)

I dont know why vs-cli looking in to wrong directory. 我不知道为什么vs-cli寻找错误的目录。

C:\usr\local\vs-cli

But the npm actually installed in the following directory 但是npm实际安装在以下目录中

C:\Program Files\nodejs\node_modules\npm

Anyone help me on this. 有人帮我这个。

Thanks 谢谢

It would be helpful to see a more verbose build output. 查看更详细的构建输出会很有帮助。 You can set your build output to diagnostic (Tools\\Options\\Projects and Solutions\\Build and Run\\MSBuild project build output verbosity). 您可以将构建输出设置为诊断(工具\\选项\\项目和解决方案\\构建和运行\\ MSBuild项目构建输出详细程度)。

Try clearing your Cordova Cache from within VS under Tools\\Options\\Tools for Apache Cordova\\Cordova Tools. 尝试从Tools下面清除Cordova Cache,在Tools \\ Options \\ Tools for Apache Cordova \\ Cordova Tools下清除。 After you have done that, re-open your project and attempt a clean build. 完成后,重新打开项目并尝试清理构建。

If you are still encountering issues at that point, you can attempt to manually install vs-mda using node following the instructions below. 如果此时仍遇到问题,可以按照以下说明尝试使用节点手动安装vs-mda。

Look for the packages folder under your VS install folder which contains vs-mda (the path will be something like this below. Note that the name of the highlighted folder will be unique to your system). 在VS安装文件夹下查找包含vs-mda的packages文件夹(路径将如下所示。请注意,突出显示的文件夹的名称对您的系统是唯一的)。

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\wgy514he.01m*\packages\vs-mda
  • Note that wgy514he.01m will not be the exact folder name, but look for something like it that contains the packages folder. 请注意,wgy514he.01m将不是确切的文件夹名称,但要查找包含packages文件夹的类似内容。

Then from an admin command prompt, run the command below. 然后从管理员命令提示符处运行以下命令。 Note that it's necessary to give the explicit path to the vs-mda folder under the VS installation path when issuing the command. 请注意,在发出命令时,必须在VS安装路径下为vs-mda文件夹提供显式路径。

npm –g install <full path to packages folder>\vs-mda

If this install was successful, you should then be able to build your Cordova project. 如果此安装成功,那么您应该能够构建Cordova项目。 Let me know if this unblocks you. 如果这打扰你,请告诉我。 If this wasn't successful, please pass along the results of the npm install command. 如果这不成功,请传递npm install命令的结果。

Had the exact same problem, caused by an unknown factor. 有一个完全相同的问题,由一个未知因素引起。 Was working just fine yesterday and this morning. 昨天和今天早上工作得很好。

Here's how I fixed it : 以下是我修复它的方法:

Steps 1-2 are from Ellen's answer, 步骤1-2来自艾伦的回答,

  1. clearing your Cordova Cache from within VS under Tools\\Options\\Tools for Apache Cordova\\Cordova Tools. 在用于Apache Cordova \\ Cordova Tools的Tools \\ Options \\ Tools下,从VS中清除Cordova Cache。

  2. Look for the packages folder under your VS install folder which contains vs-mda 在VS安装文件夹下查找包含vs-mda的packages文件夹

  3. I copied that folder to the build's target folder (C:\\Users\\MyName\\AppData\\Roaming\\npm\\node_modules). 我将该文件夹复制到构建的目标文件夹(C:\\ Users \\ MyName \\ AppData \\ Roaming \\ npm \\ node_modules)。

  4. Had a new error while building : 'node' is not recognized as an internal or an external command while using phonegap/cordova 构建时出现新错误: 使用phonegap / cordova时,'node'不会被识别为内部或外部命令

  5. Followed the solution in the link ( add node as environement variable. ) 遵循链接中的解决方案(将节点添加为环境变量。)

  6. Reboot. 重启。

  7. Success build. 成功建立。

  8. Celebrate by drinking coffee while furiously deploying my 2 button's cordova app. 通过喝咖啡庆祝,同时疯狂地部署我的2按钮的cordova应用程序。

Note : I am using visual studio 2013 update 4. Win 7 os. 注意:我使用的是visual studio 2013 update 4. Win 7 os。

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

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