2014-04-01 50 views
1

我想创建一个应用程序使用Apache Cordova,我努力安装它。 最后,当一切工作就好了,我试图添加一个插件,使用此命令:Apache Cordova无法加载插件

C:\hello>cordova plugin add org.apache.cordova.console 

然后出现以下消息:

Fetching plugin "org.apache.cordova.console" via plugin registry 

一会儿一个错误出现后:

Error: Failed to fetch package information for org.apache.cordova.console 
at C:\Users\pc\AppData\Roaming\npm\node_modules\cordova\node_modules\plugman 
\src\registry\registry.js:32:20 
at Request.cb [as _callback] (C:\Users\pc\AppData\Roaming\npm\node_modules\c 
ordova\node_modules\plugman\src\registry\registry.js:251:9) 
at self.callback (C:\Users\pc\AppData\Roaming\npm\node_modules\cordova\node_ 
modules\plugman\node_modules\request\index.js:148:22) 
at Request.EventEmitter.emit (events.js:117:20) 
at ClientRequest.self.clientErrorHandler (C:\Users\pc\AppData\Roaming\npm\no 
de_modules\cordova\node_modules\plugman\node_modules\request\index.js:257:10) 
at ClientRequest.EventEmitter.emit (events.js:95:17) 
at Socket.socketErrorListener (http.js:1547:9) 
at Socket.EventEmitter.emit (events.js:95:17) 
at net.js:440:14 
at process._tickCallback (node.js:415:13) 
+0

我的家伙有什么问题? –

回答

1

另一种简单的方法是

  1. 从混帐
  2. 下载插件为ZIP解压缩zip一些路径
  3. 运行cordova plugin add cordova-plugin-splashscreen-master(替换“科尔多瓦 - 插件,闪屏主”与您的文件夹名称)
1

确保您在创建的cordova项目中添加了atlest一个平台。 然后尝试通过命令行界面直接从github下载(确保你在项目主管里面)。

例如:对于控制台插件

科尔多瓦插件添加https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git

其他插件github上链接科尔多瓦文档中发现自己

http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html

如果安装仍然fails.It指插件已弃用于您正在使用的cordova版本。在这种情况下,请尝试升级cordova,然后创建一个新项目并重复相同的操作。

升级可以使用命令

NPM更新-g科尔多瓦

+0

我试过它的人,它没有工作。我添加了android平台,我在正确的目录中。我有最后一个科尔多瓦版本。 –

+0

检查我的替代solution.I发布它作为答案。它很长的过程。但它可能工作 – ShinyJos

0

生病建议你的另一method.Its长,但它会完成这项工作。

所有的插件都可以在github上 例下载:

https://github.com/apache/cordova-plugin-splashscreen

下载的zip文件。

所有插件将落入插件目录并进入结构在文件建立限定rm命令本

例如插件/ org.apache.cordova.core.splashscreen /万维网

手动创建这样的结构和取代从GitHub下载的WWW文件夹 插件内/ org.apache.cordova.core.splashscreen/WWW

手动添加功能config.xml中

<feature name="SplashScreen"> 
<param name="android-package" value="org.apache.cordova.SplashScreen" /> 
</feature> 

请参阅文档。

http://cordova.apache.org/docs/en/3.0.0/cordova_splashscreen_splashscreen.md.html#Splashscreen

构建应用程序。它将工作