无法在Windows 7上使用Visual Studio 2015 RC构建Apache Cordova

时间:2015-06-14 18:45:19

标签: cordova ionic visual-studio-2015 visual-studio-cordova

我无法在Windows 7上使用VS 2015RC构建Apache Cordova应用程序。它会抛出这些错误:

Severity    Code    Description Project File    Line
Error   TS2304  Cannot find name 'angular'. App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\App.ts 9
Error   TS2304  Cannot find name 'angular'. App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\App.ts 19
Error   TS2304  Cannot find name 'ng'.  App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\App.ts 24
Error   TS2304  Cannot find name 'ng'.  App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\App.ts 25
Error   TS2305  Module 'Ionic' has no exported member 'IConfigProvider'.    App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\App.ts 26
Error   TS2304  Cannot find name 'ng'.  App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\App.ts 94
Error   TS2304  Cannot find name 'ng'.  App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\App.ts 110
Error   TS2305  Module 'Ionic' has no exported member 'ILoading'.   App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\App.ts 110
Error   TS2305  Module 'Ionic' has no exported member 'IHistory'.   App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\controllers\navigationController.ts    17
Error   TS2305  Module 'Ionic' has no exported member 'ITabsDelegate'.  App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\controllers\navigationController.ts    18
Error   TS6053  File 'C:/Users/Justas/documents/visual studio 2015/Projects/cordovatest/cordovatest/App/ts/lib/typings/definitelytyped/angularjs/angular.d.ts' not found.   App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\imports.ts 1
Error   TS6053  File 'C:/Users/Justas/documents/visual studio 2015/Projects/cordovatest/cordovatest/App/ts/lib/typings/definitelytyped/cordova/cordova.d.ts' not found. App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\imports.ts 2
Error   TS6053  File 'C:/Users/Justas/documents/visual studio 2015/Projects/cordovatest/cordovatest/App/ts/lib/typings/definitelytyped/cordova-ionic/cordova-ionic.d.ts' not found. App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\imports.ts 3
Error   TS6053  File 'C:/Users/Justas/documents/visual studio 2015/Projects/cordovatest/cordovatest/App/ts/lib/typings/definitelytyped/angular-ui-router/angular-ui-router.d.ts' not found. App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\imports.ts 4
Error   TS6053  File 'C:/Users/Justas/documents/visual studio 2015/Projects/cordovatest/cordovatest/App/ts/lib/typings/ionic-typescript-definitions/beta14/ionic.d.ts' not found.   App C:\Users\Justas\documents\visual studio 2015\Projects\cordovatest\cordovatest\App\ts\imports.ts 5

我尝试重新安装vs-tac,通过NuGet数据包管理器安装所有相关的库,但这并没有解决问题。有什么明显的东西让我失踪吗?我正在使用本指南 - https://msdn.microsoft.com/en-GB/library/dn771551.aspx

更新:我的imports.ts文件包含以下行:

/// <reference path="lib/typings/definitelytyped/angularjs/angular.d.ts" />
/// <reference path="lib/typings/definitelytyped/cordova/cordova.d.ts" />
/// <reference path="lib/typings/definitelytyped/cordova-ionic/cordova-ionic.d.ts" />
/// <reference path="lib/typings/definitelytyped/angular-ui-router/angular-ui-router.d.ts" />
/// <reference path="lib/typings/ionic-typescript-definitions/beta14/ionic.d.ts" />

2 个答案:

答案 0 :(得分:1)

您需要为TypeScript编译器启用外部模块。 如果您正在使用gulp-typescript,请在​​ts项目def:

中设置它
noExternalResolve: false

答案 1 :(得分:1)

对于您在imports.ts文件中引用的文件,请确保它们都存在于磁盘上的那些文件路径中。您应该可以从https://github.com/borisyankov/DefinitelyTyped下载所有定义。至于离子定义,看起来你正试图使用​​https://github.com/danibo86/ionic-typescript-definitions,这应该有效。在正确的文件路径下,您的项目应该构建。