[英]npm install with several package.json
I have a project that has a submodule which also has a submodule, each of them (root & submodule_1 & submodule_2) have a package.json
. 我有一个包含子模块的项目,该子模块也有一个子模块,每个子模块(root和submodule_1&submodule_2)都有一个
package.json
。
Here is how I scaffolded my project : 这是我搭建项目的方式:
|root
----|node_modules
----|package.json
----|someFolder
----|submodule_1
-------- |package.json
-------- |someFolder
-------- |submodule_2
------------ |package.json
------------ |someFolder
Is it possible to precise to npm to install each dependencies in the root node_modules
? 是否有可能精确到npm在根
node_modules
安装每个依赖node_modules
? I don't want submodule_1 and submodule_2 to be dependencies, I just want the packages.json to be installed in the root node_modules
. 我不希望submodule_1和submodule_2成为依赖项,我只想将packages.json安装在根
node_modules
。
If it is possible, how can I achieve this ? 如果有可能,我该如何实现?
Thanks for your help 谢谢你的帮助
抱歉,无法精确到npm在根目录中安装每个依赖项
All dependencies and subdependencies are installed in root node_modules
by default, only duplicated dependencies/subdependencies are exception. 默认情况下,所有依赖项和子依赖项都安装在根
node_modules
,只有重复的依赖项/子依赖项才是例外。
npm
will install duplicated dependencies in root node_modules
if all of them are/can be installed in same version. 如果所有/都可以在相同版本中安装,则
npm
将在根node_modules
安装重复的依赖项。
You can read more about packages deduplication here https://docs.npmjs.com/cli/dedupe 您可以在https://docs.npmjs.com/cli/dedupe上阅读有关软件包重复数据删除的更多信息。
You can also do this manually by calling npm dedupe
您也可以通过调用
npm dedupe
手动执行此操作
在深入研究npm docs和所有文档之后,我意识到将submodule_1设置为本地依赖项 ,将submodule_2设置为submodule_1的依赖项正是我想要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.