我修复了这个或者一个非常类似的问题,我在Visual Studio 2015社区TACO Apache Cordova项目(我正在研究的那个项目或来自该项目的空白新项目)中进行调试(我假设在发布版本中)。模板 - 这是我在大约24小时前从这里,下面,空白的那里提供的输出,但现在这个问题已经神秘地发生了#39;又出现了。
Error Cannot find module 'C:\Users\myusername\Documents\Visual Studio 2015\Projects\BlankCordovaApp3TestZ\BlankCordovaApp3TestZ\node_modules\vs-tac\app.js'
(路径的最后一部分不存在,即没有\ node_modules \文件夹。当然,这里有一个vs-tac文件夹,
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\APACHECORDOVATOOLS\packages\vs-tac
,如底部的BUILD输出中所述。一些更新的信息:我看到在我取消/重新安装所有项目插件之前我成功调试的项目确实有node_modules文件夹,其中包含许多子文件夹,但没有vs-tac。
我让一切正常:在Ripple,Android AVD和我的Android设备上进行调试。两天前我清除了Cordova缓存(出于愚蠢的原因)并开始收到错误。
经过几个小时的故障排除后,我再次开始工作,我想通过跑步(我的最后一次尝试):
npm install -g npm
再次能够调试后,我今天决定卸载我的项目的jquery模块(2.2.3),看起来我需要卸载jquery.mobile(1.4.5) )和Bootstrap(3.3.7)也这样做,因为我认为我可能有一个太高版本的jquery导致我的项目代码出现问题。我在2.1.0重新安装了除jquery之外的相同内容。
刚刚提到模块卸载/重新安装后,vs-tac问题又回来了!此外,第一次,依赖树中没有安装NPM依赖项问题!稍微搞乱之后,我从模板中打开了一个新的Apache Cordova项目......依赖问题已经消失,但vs-tac构建问题却没有。
我今天再次尝试了所有上述修复atttemps,这次无法解决,到目前为止......
C:\Windows\System32>npm install -g npm
C:\Users\myusername\AppData\Roaming\npm\npm -> C:\Users\myusername\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
C:\Users\myusername\AppData\Roaming\npm\npx -> C:\Users\myusername\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
+ npm@5.3.0
updated 1 package in 64.141s //This update seems to happen every time I run this command, which is odd for something global
C:\Windows\System32>npm install -g "C:\Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\Packages\vs-tac"
C:\Users\myusername\AppData\Roaming\npm\vs-tac-cli -> C:\Users\myusername\AppData\Roaming\npm\node_modules\vs-tac\vs-tac-cli.cmd
+ vs-tac@1.0.42
updated 1 package in 4.406s
Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3
Microsoft .NET Framework Version 4.7.02046
Installed Version: Community
Visual Studio Tools for Apache Cordova Update 10
Microsoft Visual Studio Tools for Applications 2015 00322-20000-00000-AA328
JavaScript Language Service 2.0
JavaScript Project System 2.0
In VS Tools > Options > Projects and Solutions > External Web Tools I have:
C:\Program Files\nodejs (at the top, then)
.\node_modules\.bin
$(VSINSTALLDIR)\Web\External
$(PATH)
$(VSINSTALLDIR)\Web\External\git
(all above are checked - not changed recently)
I don't think what is in VS Tools > Options > Tools for Apache Cordova > Environment Variable Overrides is relevant in this case and did not include.
Cordova CLI --> 6.1.1 (per the test project's config.xml)
// From VS Package Manager Conole -->
Path
----
C:\Users\myusername\Documents\Visual Studio 2015\Projects\BlankCordovaApp3TestZ\BlankCordovaApp3TestZ // this is my new template test project
PM> node -v
v6.9.1
PM> npm list cordova
BlankCordovaApp3TestZ@1.0.0 C:\Users\myusername\Documents\Visual Studio 2015\Projects\BlankCordovaApp3TestZ\BlankCordovaApp3TestZ
`-- (empty)
PM> npm list -g cordova
C:\Users\myusername\AppData\Roaming\npm
`-- cordova@7.0.1
PM> cordova platform version android
Installed platforms:
Available platforms:
android ~6.2.2
blackberry10 ~3.8.0 (deprecated)
browser ~4.1.0
webos ~3.7.0
windows ~5.0.0
1>------ Build started: Project: BlankCordovaApp3TestZ, Configuration: Debug Android ------
1> ------ Ensuring correct global installation of package from source package directory: C:\PROGRAM FILES\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: 1.0.42
1> ------ Package not currently installed globally.
1> ------ Installing globally from source package. This could take a few minutes...
1> Each package is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.
1> ENOENT, no such file or directory ''
1>MSBUILD : cordova-build error : module.js:338
1> module.js:338
1>MSBUILD : cordova-build error : throw err;
1> throw err;
1>MSBUILD : cordova-build error : ^
1> ^
1>MSBUILD : cordova-build error BLD401: Error : BLD00401 : Could not find module 'C:\Users\myusername\Documents\Visual Studio 2015\Projects\BlankCordovaApp3TestZ\BlankCordovaApp3TestZ\node_modules\vs-tac\app.js'. Please Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache and try building again.
1> Error Cannot find module 'C:\Users\myusername\Documents\Visual Studio 2015\Projects\BlankCordovaApp3TestZ\BlankCordovaApp3TestZ\node_modules\vs-tac\app.js'
1>MSBUILD : cordova-build error : at Function.Module._resolveFilename (module.js:336:15)
1> at Function.Module._resolveFilename (module.js:336:15)
1>MSBUILD : cordova-build error : at Function.Module._load (module.js:278:25)
1> at Function.Module._load (module.js:278:25)
1>MSBUILD : cordova-build error : at Function.Module.runMain (module.js:501:10)
1> at Function.Module.runMain (module.js:501:10)
1>MSBUILD : cordova-build error : at startup (node.js:129:16)
1> at startup (node.js:129:16)
1>MSBUILD : cordova-build error : at node.js:814:3
1> at node.js:814:3
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
我今天尝试的新内容 - >
npm config set prefix %APPDATA%\npm
npm config set cache %APPDATA%\npm-cache
(因为我在某些时候也将vs-tac复制到我的漫游文件夹中)......这对构建没有任何影响。
另外,实现我的config.xml将CLI设置为6.1.1,所以我将其更改为匹配全局安装的版本7.0.1 - 对构建没有影响。
非常感谢任何帮助。
提前致谢。