简体   繁体   English

Ionic - 无法通过注册表获取插件

[英]Ionic - Failed to fetch plugin via registry

I want to add an alarm to my application.我想向我的应用程序添加警报。

I have tried to install cordova plugin add https://github.com/wnyc/cordova-plugin-wakeuptimer.git in to my project.我尝试安装cordova plugin add https://github.com/wnyc/cordova-plugin-wakeuptimer.git到我的项目中。

When I run command I get:当我运行命令时,我得到:

Failed to fetch plugin https://github.com/wnyc/cordova-plugin-wakeuptimer.git via registry.无法通过注册表获取插件https://github.com/wnyc/cordova-plugin-wakeuptimer.git
Probably this is either a connection problem, or plugin spec is incorrect.这可能是连接问题,或者插件规范不正确。

在此处输入图像描述

Ionic Info:离子信息:

Ionic:离子:

Ionic CLI: 5.4.16离子 CLI:5.4.16
Ionic Framework: @ionic/angular 5.1.1离子框架:@ionic/angular 5.1.1
@angular-devkit/build-angular: 0.901.7 @angular-devkit/build-angular: 0.901.7
@angular-devkit/schematics: 9.1.7 @angular-devkit/原理图:9.1.7
@angular/cli: 9.1.7 @角/cli:9.1.7
@ionic/angular-toolkit: 2.2.0 @ionic/角度工具包:2.2.0

Cordova: Cordova:

Cordova CLI: 9.0.0 (cordova-lib@9.0.1) Cordova CLI:9.0.0(cordova-lib@9.0.1)
Cordova Platforms: android 8.1.0, ios 5.1.1 Cordova 平台:android 8.1.0、ios 5.1.1
Cordova Plugins: cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins) Cordova 插件:cordova-plugin-ionic-keyboard 2.2.0、cordova-plugin-ionic-webview 4.2.1(和其他 4 个插件)

Utility:效用:

cordova-res: 0.9.0科尔多瓦分辨率:0.9.0
native-run: 0.3.0本机运行:0.3.0

System:系统:

Android SDK Tools: 26.1.1 Android SDK 工具:26.1.1
NodeJS: v12.14.1节点JS:v12.14.1
npm: 6.13.4 npm:6.13.4
OS: Windows 10操作系统:Windows 10

Error is solved by following the below steps:按照以下步骤解决错误:

1. Download repository source code 1.下载存储库源代码
If the plugin is hosted on Github, you can clone it into a local folder on your computer using git eg (in this example will be cloned into C:/Users/Me/Desktop):如果插件托管在 Github 上,您可以使用 git 将其克隆到计算机上的本地文件夹中,例如(在此示例中将克隆到 C:/Users/Me:/Users/Me:/

git clone https://github.com/wnyc/cordova-plugin-wakeuptimer.git    

In the clone directory, it should be now (once finished) a new folder with the name of the cloned repository.在克隆目录中,它现在(一旦完成)应该是一个具有克隆存储库名称的新文件夹。

2. Create the package.json file 2.创建package.json文件
To create a new package file for the plugin, you will obviously use Node.js in the command line and execute the following command (once located with the terminal in the folder of plugin):要为插件创建一个新的 package 文件,您显然将在命令行中使用 Node.js 并执行以下命令(一旦位于插件文件夹中的终端中):

npm init

This command will start an interactive prompt (that you can simply skip by pressing Enter on every question) that will allow you to create your package.json file.此命令将启动一个交互式提示(您可以通过在每个问题上按 Enter 键跳过),这将允许您创建 package.json 文件。 Obviously, although isn't necessary, you should provide correctly all the information显然,虽然没有必要,但您应该正确提供所有信息

3. Install it from the local source 3.从本地源安装
As the final step, you can install the plugin from the cloned repository but instead of providing the git URL, provide the local path to the plugin:作为最后一步,您可以从克隆的存储库安装插件,但不要提供 git URL,而是提供插件的本地路径:

cd FolderOfYourCordovaProject //Where you want to add a plugin

cordova plugin add F:\WorkSpace\cordova-plugin-wakeuptimer 

When I am adding plugin in my project It throws an error当我在我的项目中添加插件时它会引发错误

Invalid Plugin: C.\Users\Me needs a valid package.json无效插件:C.\Users\Me 需要有效的 package.json

Then I copied that plugin into the same disk/ same folder where the project is located.然后我将该插件复制到项目所在的同一个磁盘/同一个文件夹中。
Then this error is also solved.然后这个错误也解决了。 And plugin added successfully.并且插件添加成功。

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

相关问题 Ionic-错误:无法通过注册表获取插件cordova-plugin-statusbar @ https://github.com/apache/cordova-plugin-statusbar.git - Ionic - Error: Failed to fetch plugin cordova-plugin-statusbar@https://github.com/apache/cordova-plugin-statusbar.git via registry phonegap cordova 3.3插件无法获取android中的注册表 - phonegap cordova 3.3 plugin fail to fetch registry in android 相机插件的离子电容器执行失败 - Ionic capacitor execution failed for camera plugin ionic 3:无法使用相机插件显示图像 - ionic 3 : Failed to display image using camera plugin 离子插件添加cordova-plugin-googlemaps后构建失败 - BUILD FAILED after ionic plugin add cordova-plugin-googlemaps “TypeError:无法获取”导致 Ionic 5 应用程序卡在启动画面上 - "TypeError: Failed to fetch" causing Ionic 5 app to be stuck on splashscreen 由于添加了Firebase Cloud Messaging插件,Ionic 3 Build应用程序失败 - Ionic 3 Build app failed due to addition of Firebase Cloud Messaging plugin 通过 Fetch React Native Post Request 引发网络请求失败 - React Native Post Request via Fetch throws Network Request Failed Ionic + Angular - 平台添加 Android 错误 - 错误:无法获取平台 cordova-android@0.0.8 - Ionic + Angular - Platform Add Android Error - Error: Failed to fetch platform cordova-android@0.0.8 离子获取联系人为Android - Ionic fetch contacts for android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM