[英]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的帮助下,执行以下操作解决了问题:
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
在我的情况下这个插件从未安装过,所以我得到了相同的消息作为错误。
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
)命名的快捷方式链接。
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
的引用。
Add the cordova component again from commandline which worked for me. 再次从命令行添加cordova组件,这对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.