【问题标题】:NPM how to install package as it was anotherNPM 如何安装软件包,因为它是另一个
【发布时间】:2019-12-04 07:32:41
【问题描述】:

想要安装包com.cordova.plugin.cache 及其内容我需要它也是cordova-plugin-cache..

示例package.json 是这样的:

"dependencies": {
    // Note these two are the same but with different name 
    "cordova-plugin-cache": "git+git@gitlab.com:dev/library/org.git",
    "com.cordova.plugin.cache": "git+git@gitlab.com:dev/library/org.git"
}

但是我在私有 npm 存储库上发布了它的修改版本,以删除依赖作为存储库。

"dependencies": {
    // Note these two are the same but with different package name 
    "cordova-plugin-cache": "git+git@gitlab.com:dev/library/org.git",
    "com.cordova.plugin.cache": "git+git@gitlab.com:dev/library/org.git"
}

这甚至可能吗?我必须保存两个包,因为它们是两个不同的包吗?

实际上我在私有 npm 注册表中有一个包,但不想复制该项目。

欢迎任何提示。

【问题讨论】:

    标签: node.js cordova npm cordova-plugins


    【解决方案1】:

    NPM 本身没有这个功能,在他们的 GitHub 仓库 here 上讨论过,决定不实现这个功能。

    article 中概述的解决方案可能会解决您的问题:

    您可以使用link-module-alias 模块,将_moduleAliases 部分添加到描述您希望建立的别名的package.json,然后添加执行上述模块的postinstall 脚​​本。

    【讨论】:

      猜你喜欢
      • 2016-11-09
      • 2021-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-28
      • 2020-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多