简体   繁体   English

npm install在node_modules中创建过多的依赖项

[英]npm install creates inordinate amount of dependencies in node_modules

This started happening just recently, but every time I run npm install I end up getting dozens of node modules beyond what's listed in package.json . 这是最近才开始发生的,但是每次运行npm install时,都会得到超出package.json列表之外的数十个节点模块。

This answer shows that this is a new feature of npm 3 where the dependencies are being "flattened" instead of nested. 该答案表明这是npm 3的新功能,其中依赖项被“展平”而不是嵌套。 However, I don't want to look at a bazillion modules every time I venture into the folder. 但是,我不想每次冒险进入该文件夹时都会看到不计其数的模块。 Is there any way I can disable this setting? 有什么办法可以禁用此设置?

No, that cannot be disabled. 不,不能禁用。

https://github.com/npm/npm/issues/10079 https://github.com/npm/npm/issues/10079

is there anyway that I can force npm@3 to install new package for me, but old way? 无论如何,我可以强制npm @ 3为我安装新软件包,但是是旧方法吗? So without calculating project-wise tree. 因此无需计算项目树。 I just want the new package to be placed in node_modules with its dependencies in its node_modules? 我只希望将新包放置在node_modules中,并将其依赖项放在node_modules中?

No. The new installer is pretty much a complete rewrite, and while there is some special-case code to install packages into siloed subdirectories, that's only available when doing global installs, to simplify packaging and managing shared tools. 不会。新安装程序几乎是完全重写,并且有一些特殊情况的代码可以将软件包安装到孤立的子目录中,只有在进行全局安装时才能使用,以简化打包和管理共享工具。

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

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