找不到'cordova'的类型定义文件:diagnostic plugin

时间:2018-02-12 15:32:01

标签: cordova typescript ionic-framework plugins ionic3

添加“Diagnostic”插件后,我无法构建我的离子3项目。

有一个错误的错误:

typescript: .....app/plugins/cordova.plugins.diagnostic/cordova.plugins.diagnostic.d.ts, line: 6
        Cannot find type definition file for 'cordova'.

   L5:  * "Dangerous" permissions that need to be requested at run-time (Android 6.0/API 23 and above)
   L6:  * See http://developer.android.com/guide/topics/security/permissions.html#perm-groups
   L7:  * @type {Object}

如何解决此问题?以下是版本信息:

"@angular/common": "^4.4.3",
"@angular/compiler": "^4.4.3",
"@angular/compiler-cli": "^4.4.3",
"@angular/core": "^4.4.3",
"@angular/forms": "^4.4.3",
"@angular/http": "^4.4.3",
"cordova": "^7.0.1",
"cordova-android": "6.3.0",
"cordova-browser": "^4.1.0",
"cordova-ios": "^4.5.3",
"ionic-angular": "^3.7.1",

如果我对此行/// <reference types="cordova" />发表评论,这是有效的,但这不是我猜的解决方案

1 个答案:

答案 0 :(得分:3)

您可以通过安装cordova类型来修复它:

npm install @types/cordova --save