繁体   English   中英

NPM如何安装软件包

[英]NPM how to install package as it was another

要安装包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注册表中有一个软件包,但不想重复该项目。

任何提示都是值得的。

故宫本身没有这样的功能,这是对他们的GitHub库讨论这里 ,并决定不实施这样的功能。

本文概述的解决方案可能证明可以解决您的问题:

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

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM