nodejs npm版本3把所有依赖包及子依赖包全部安装在node_modules根目录的问题
程序员文章站
2022-05-29 09:40:08
...
npm从版本3开始把所有依赖包及其子依赖包全部安装在node_modules根目录。文件夹特别多,显得有点混乱,不太好管理。
Your dependencies will now be installed maximally flat. Insofar as is possible, all of your dependencies, and their dependencies, and THEIR dependencies will be installed in your project's node_modules
folder with no nesting. You'll only see modules nested underneath one another when two (or more) modules have conflicting dependencies.
--legacy-bundling也不再支持,目前要想按以前的方式把子依赖包安装到对应依赖包文件夹下面的话,只能是把npm降级到版本2,如下命令:
[[email protected] pengpengzhou] nvm use v4.6.0
Now using node v4.6.0 (npm v2.15.9)
[[email protected] pengpengzhou] npm -v
2.15.9