【问题标题】:how to install cordova plugin through github url and set its configuration in config.xml如何通过 github url 安装 cordova 插件并在 config.xml 中设置其配置
【发布时间】:2018-05-14 06:16:03
【问题描述】:
<plugin name="cordova-plugin-intent-action" spec="git+https://github.com/ngocdaothanh/cordova-plugin-intent-action.git" />
<plugin name="co.mylonas.cordova.applicationstate" spec="git+https://github.com/leomylonas/cordova-plugin-applicationstate.git" />

我正在尝试在我的 cordova 应用程序中安装这两个插件。当我运行命令 cordova plugin add --PluginName@gitURL-- 时,它可以工作。但是当我运行cordova platform add android时,它给了我以下错误。

在我使用科尔多瓦 6.1.1 和节点 6.9.5 之前,一切都运行良好。但是在升级两者之后,我看到了这个问题。

注意:我正在使用 科尔多瓦 7.1.0 节点 8.9.1 npm 5.5.1

【问题讨论】:

    标签: cordova ionic-framework cordova-plugins ngcordova


    【解决方案1】:

    git+https 是仅由 git 客户端使用的方案。只需删除 git+ 部分。

    但是我不建议您为插件使用远程存储库,因为现在有两次这样的存储库消失了,要么是由于名称更改,要么只是被删除了。

    我建议您将其克隆到本地路径,签出所需的标签/分支,从中删除内部 .git 目录并将整个内容提交到您的主项目。您可以将其添加为

    <plugin name="the-plugin-name" spec="stored-plugins/that-important-plugin" />
    

    【讨论】:

    • 但即使是那些保存在本地的插件,也会出现同样的错误。 无法获取已安装模块的绝对路径你有什么建议,我该如何使用这些插件的绝对路径?
    • 简单地删除 git+ 部分应该适用于远程存储库。将它们保留在本地的建议仅仅是,如果您不信任人们将它们维护到位,或者不使用向后不兼容的更改更新指定的分支(未指定时为主分支)。
    • 感谢@coladict,删除 git+ 对我有用。但是您能否再帮我解决一个问题:有一个插件,我是从本地目录(不是远程)添加的,但它正在转义一些文件。就像我添加 IOS 平台时一样,它会忽略 .framework 文件以及类似的一些 Android 文件。
    • 我是这样添加的:
    • 转义文件是什么意思?
    猜你喜欢
    • 1970-01-01
    • 2019-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多