简体   繁体   English

无法安装Ionic-Native File插件

[英]Cannot install Ionic-Native File plugin

I have an Ionic 3 project to which I am trying add Ionic Native File plugin, using the command: 我有一个Ionic 3项目,我正在尝试使用以下命令添加Ionic Native File插件:

ionic cordova plugin add cordova-plugin-file

However, I am getting the following error: 但是,我收到以下错误:

L:\MyTrials\test\ionic\locations-app>ionic cordova plugin add cordova-plugin-file
> cordova plugin add cordova-plugin-file --save
x Running command - failed!
[ERROR] An error occurred while running cordova plugin add cordova-plugin-file

    --save (exit code 1):

    Error: Failed to fetch plugin file:node_modules\cordova-plugin-file 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 ERR! code ENOLOCAL
    npm ERR! Could not install from "node_modules\cordova-plugin-file" as it
    does not contain a package.json file.

    npm ERR! A complete log of this run can be found in:
    npm ERR!
    C:\Users\xxx\AppData\Roaming\npm-cache\_logs\2017-09-21T05_16_31_940Z-debug.log

I have already tried other command such as: 我已经尝试过其他命令,例如:

cordova plugin add cordova-plugin-file

and

cordova plugin add cordova-plugin-file --nofetch

but I am basically getting the same error. 但我基本上得到了同样的错误。

My internet connection is fine and I ran these commands as Administrator. 我的网络连接很好,我以管理员身份运行这些命令。

It seems that only the File plugin may be having these issues. 似乎只有File插件可能会遇到这些问题。 I could install the Ionic Native Datepicker plugin without any issues. 我可以安装Ionic Native Datepicker插件,没有任何问题。

Any help is appreciated! 任何帮助表示赞赏!

As can be seen in the question's comments, with the help of @amin arghavani, doing the following resolved the issue: 从问题的评论中可以看出,在@amin arghavani的帮助下,执行以下操作解决了问题:

  1. Remove the plugin if its already installed: ionic cordova plugin rm cordova-plugin-file In my case this plugin was never installed so I got the same message as an error. 删除插件如果已经安装: ionic cordova plugin rm cordova-plugin-file在我的情况下这个插件从未安装过,所以我得到了相同的消息作为错误。

  2. Check if a folder for the plugin is present under the project's node_modules folder. 检查项目的node_modules文件夹下是否存在该插件的文件夹。 In my case I actually found a shortcut link named after the plugin ( cordova-plugin-file ) which I've deleted. 在我的情况下,我实际上找到了一个以我删除的插件( cordova-plugin-file )命名的快捷方式链接。

  3. Check if plugin is included in the project's package.json as a dependency or developer dependency. 检查插件是否包含在项目的package.json作为依赖项或开发人员依赖项。 In my case I found the reference to cordova-plugin-file under dependencies (which I deleted and saved) in package.json . 在我的例子中,我在package.json找到了依赖关系(我删除并保存)下的cordova-plugin-file的引用。

  4. Add the cordova component again from commandline which worked for me. 再次从命令行添加cordova组件,这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ionic 4 - 使用 @ionic-native/file/ngx/cordova-plugin-file 访问 iOS 文件 - ionic 4 - iOS file access with @ionic-native/file/ngx/cordova-plugin-file @ ionic-native /打印机不起作用 - @ionic-native/printer is not working @ ionic-native / push的离子问题 - ionic issues with @ionic-native/push Ionic (v3.19.1):使用 ionic-native/file 创建的文件不可见 - Ionic (v3.19.1): Created file is not visible using ionic-native/file IONIC 3 无法使用@ionic-native/file-opener 在 Android 中打开 PDF 文件 - IONIC 3 Can't not open PDF file in Android with @ionic-native/file-opener 使用GooglePlus离子本机时出错 - Error while using GooglePlus ionic-native Android 10 @ionic-native/file-transfer /file-opener 不工作 - Android 10 @ionic-native/file-transfer /file-opener not working 使用 @ionic-native/file/ngx 从 Android 下载文件夹读取文本文件时出现问题 - Android 11 - Issue when reading text file from Android Download folder with @ionic-native/file/ngx - Android 11 运行 ionic cordova add platform android 后的 Ionic 3,我的 ionic-native/file,filepath,transfer 发生错误 - Ionic 3 after running ionic cordova add platform android, error occurs to my ionic-native/file,filepath,transfer 如何使用ionic 3 @ ionic-native / http在本地HTTP中传递FormData? - How can pass FormData in native HTTP with ionic 3 @ionic-native/http?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM