npm install creates inordinate amount of dependenc

2019-07-15 21:33发布

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.

This answer shows that this is a new feature of npm 3 where the dependencies are being "flattened" instead of nested. 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?

标签: node.js npm
1条回答
Juvenile、少年°
2楼-- · 2019-07-15 21:55

No, that cannot be disabled.

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? 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?

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.

查看更多
登录 后发表回答