gpt4 book ai didi

node.js - NPM 如何安装另一个包

转载 作者:太空宇宙 更新时间:2023-11-03 23:14:32 25 4
gpt4 key购买 nike

想要安装包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"
}

但我在私有(private) 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"
}

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

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

欢迎任何提示。

最佳答案

NPM 本身没有这样的功能,它在他们的 GitHub 存储库上进行了讨论 here并且决定不实现这样的功能。

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

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

关于node.js - NPM 如何安装另一个包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57211834/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com