【问题标题】:Adding cordova-plugin-file error添加科尔多瓦插件文件错误
【发布时间】:2017-09-17 15:48:09
【问题描述】:

我正在尝试将“文件”插件添加到我的 Phonegap 项目中,但它返回错误:

d:\Android\projects\myProject>phonegap plugin add cordova-plugin-file
Error: Failed to fetch plugin git+https://github.com/apache/cordova-plugin-file.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm WARN cordova-plugin-camera@2.1.1 requires a peer of cordova-plugin-file@>=2.0.0 but none was installed.
npm WARN cordova-plugin-file-transfer@1.5.1 requires a peer of cordova-plugin-file@^3.0.0 but none was installed.
npm WARN cordova-plugin-media-capture@1.2.0 requires a peer of cordova-plugin-file@^3.0.0 but none was installed.
npm WARN com.phonegap.helloworld@1.0.0 No repository field.
npm WARN com.phonegap.helloworld@1.0.0 No license field.
npm ERR! code 1

向Phonegap/Cordova项目添加“文件”插件的正确方法是什么?

ps:我使用的是 Windows cmd。

更新:

尝试添加启用了--save 选项的插件:

d:\Android\projects\myProject>phonegap plugin add cordova-plugin-file --save -d
No scripts found for hook "before_plugin_add".

No version specified for cordova-plugin-file, retrieving version from package.json

Calling plugman.fetch on plugin "cordova-plugin-file@^4.0.0"

saving

Running command: cmd "/s /c "D:\xampp\nodejs\npm.cmd install cordova-plugin-file@^4.0.0 --save""

Command finished with error code 1: cmd /s /c "D:\xampp\nodejs\npm.cmd install cordova-plugin-file@^4.0.0 --save"

Error: Failed to fetch plugin cordova-plugin-file@^4.0.0 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm WARN cordova-plugin-file-transfer@1.5.1 requires a peer of cordova-plugin-file@^3.0.0 but none was installed.
npm WARN cordova-plugin-media-capture@1.2.0 requires a peer of cordova-plugin-file@^3.0.0 but none was installed.
npm WARN com.phonegap.helloworld@1.0.0 No repository field.
npm WARN com.phonegap.helloworld@1.0.0 No license field.
npm ERR! code 1

【问题讨论】:

  • 尝试在您的 config.xml 中添加这个 - '
    Error: Failed to fetch plugin cordova-plugin-file@^4.0.0 via registry.
  • 你是怎么解决这个问题的?

标签: cordova cordova-plugins phonegap cordova-plugin-file


【解决方案1】:

看来它是科尔多瓦版本的错误。你用的是哪个版本?。尝试使用其他版本,例如 6.5.0

npm i cordova@6.5.0

再次尝试安装插件

cordova plugin add cordova-plugin-file

让我知道它是否适合你

【讨论】:

  • 没有帮助。 phonegapis 7.0.1 版本
猜你喜欢
相关资源
最近更新 更多
热门标签