Visual Studio 2015 不适用于 Apache Cordova 工具

Visual Studio 2015 won't work with Tools For Apache Cordova

我完成了 VS 2015 Enterprise + Tools for Apache Cordova 的完整安装。当我打开或创建任何项目时,它不会构建,甚至不会在 运行 按钮上显示 Ripple 模拟器或设备信息。

我已经完全重新安装了,但还是一样。

当我单击配置中的依赖项检查按钮时 Window 说一切正常。

当我尝试构建时:

npm ERR! Windows_NT 6.3.9600 1> npm ERR! argv "node" "C:\Users\%UserProfile%\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "-g" "install" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac" "--loglevel" "warn" 1> npm ERR! node v0.12.2 1> npm ERR! npm v2.12.0 1> npm ERR! undefined is not a function 1> npm ERR! 1>RUNMDAINSTALL : npm ERR! If you need help, you may report this error at: 1> npm ERR! https://github.com/npm/npm/issues 1> npm ERR! Please include the following file with any support request: 1> npm ERR! C:\Users\%UserProfile%\Documents\Visual Studio 2015\Projects\BlankCordovaApp10\BlankCordovaApp10\npm-debug.log 1> ------ npm install failed. Exit code: 1 1> ------ Package installation failed. Retrying... 1> npm WARN uninstall not installed in C:\Program Files (x86)\nodejs\node_modules: "vs-tac" 1> npm ERR! Windows_NT 6.3.9600 1> npm ERR! argv "node" "C:\Users\%UserProfile%\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "-g" "install" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac" "--loglevel" "warn" 1> npm ERR! node v0.12.2 1> npm ERR! npm v2.12.0 1> npm ERR! undefined is not a function 1> npm ERR! 1>RUNMDAINSTALL : npm ERR! If you need help, you may report this error at: 1> npm ERR! https://github.com/npm/npm/issues 1> npm ERR! Please include the following file with any support request: 1> npm ERR! C:\Users\%UserProfile%\Documents\Visual Studio 2015\Projects\BlankCordovaApp10\BlankCordovaApp10\npm-debug.log 1> ------ npm install failed. Exit code: 1 1> ------ Package installation failed. Retrying... 1> npm WARN uninstall not installed in C:\Program Files (x86)\nodejs\node_modules: "vs-tac" 1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets(287,5): error : Error installing local npm package. 1>MSBUILD : cordova-build error BLD401: Error : BLD00401 : Could not find module 'C:\Users\%UserProfile%\AppData\Roaming\npm\node_modules\vs-tac\app.js'. Please Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache and try building again.

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我确实使用“配置”按钮清理了缓存,但还是一样。当 运行 npm cache clear 安装包时,运行 按钮不显示设备信息,如我之前所说。

编辑:

@Subhag Oak 谢谢!这从 运行 按钮带回了菜单选项,但是当我尝试 Run/Build:

时仍然出错

------ npm install of vs-tac@1.0.0 from C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\APACHECORDOVATOOLS\packages\vs-tac completed. 1>MSBUILD : cordova-build error BLD401: Error : BLD00401 : Could not find module 'C:\Users\FilipeAugusto\AppData\Roaming\npm\node_modules\vs-tac\app.js'. Please Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache and try building again. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我们认为,我们有解决方法。您能否尝试以下解决方案:

  • 关闭所有 VS 实例
  • cd "%localappdata%\Microsoft\Phone 工具"
  • 重命名 CoreCon 文件夹
  • 再次启动 VS。

让我们知道这是否解决了问题?

通过全局安装 Cordova 然后开始安装似乎缺少的 vs-tac(不确定是否需要全局安装 Cordova)。 来自此处的信息 (https://social.msdn.microsoft.com/Forums/en-US/4f97d8c5-6069-49ee-a065-283741fd483f/unable-to-build-my-first-cordova-app-in-vs-2015?forum=ToolsForApacheCordova):

npm install -g cordova
npm install -g "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac"

然后出现以下错误:

EXDEV, cross-device link not permitted

幸运的是,有关于如何解决这个问题的指南 ():

C:\Temp>git clone https://github.com/phonegap/phonegap-plugin-fast-canvas.git

然后转到项目文件夹和运行以下内容:

cordova plugin add C:\Temp\phonegap-plugin-fast-canvas\

它正在运行!

我通过以下步骤解决了这个问题: 1. 从以下位置复制 vs-tac 文件夹:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\Packages\A​​ppData 漫游文件夹

  1. 我在 AppData\roaming 文件夹中打开了一个 VS 2015 开发人员提示,我在其中复制了 vs-tac 包和 运行 npm install

要解决此问题,请先关闭 VS 然后 复制文件夹 vs-tac 来自

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\Packages\

C:\Users\ASUS S550C\AppData\Roaming\npm\node_modules

然后,如果您在新路径中看不到名为 cordova 的文件夹

1- 打开 CMD 或 Termianl 并写入

cd C:\Users\ASUS S550C\AppData\Roaming\npm\node_modules
npm install -g cordova 

2-然后写

  cd C:\Users\ASUS S550C\AppData\Roaming\npm\node_modules\cordova
    npm install

这将解决问题

注意:要使用 npm,您需要安装 Node.js