Transpile errors with cordova-plugin-file-transfer(使用 cordova-plugin-file-transfer 编译错误)
问题描述
我想使用 cordova 文件传输插件.我通过 Ionic-Native 传输模块 使用它.
I want to use the cordova file transfer plugin. I'm using it through the Ionic-Native transfer module.
应用程序无法运行,因为文件传输插件和 文件插件:
The app won't run because there is a transpile error with the file transfer plugin and the file plugin:
我通过 npm 安装了 @types/cordova-plugin-file
,但由于两个 cordova-plugin-file 包中的标识符重复,应用程序无法运行:
I installed @types/cordova-plugin-file
through npm, but the app won't run because of duplicate identifiers in the two cordova-plugin-file packages:
这里的正确方法是什么?
What is the right approach here?
推荐答案
如前所述,cordova-plugin-file-transfer 中的类型似乎不正确.
As mentioned, it looks like the typings in cordova-plugin-file-transfer are incorrect.
它应该是一个外部模块,但它目前是一个脚本文件(直接从DefiniteTyped复制).
It should be an external module but it is currently a script file (copied from DefinitelyTyped directly).
另一方面,由于 cordova-plugin-file 已经包含了自己的类型,你不需要安装 @types/cordova-plugin-file.
On the other hand, since cordova-plugin-file already includes its own typings, you don't need to install @types/cordova-plugin-file.
我也遇到过这个问题.
但是我能够通过以下操作解决该问题:
However I was able to work around the issue with the following operations:
设置:
最初的问题:
解决步骤:
- 移除平台
- 移除 Cordova 插件
- 重建项目
- 添加平台
- 移除 cordova-plugin-file-transfer 插件
重建ios项目
- Remove Platform
- Remove Cordova plugin
- Rebuild project
- Add Platform
- Remove cordova-plugin-file-transfer plugin
Rebuild ios project
正在添加 ios 项目...为 iOS 平台创建 Cordova 项目:
Adding ios project... Creating Cordova project for the iOS platform:
这篇关于使用 cordova-plugin-file-transfer 编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!