nodejs npm版本3把所有依赖包及子依赖包全部安装在node_modules根目录的问题

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,如下命令:

[root@dev pengpengzhou] nvm use v4.6.0
Now using node v4.6.0 (npm v2.15.9)
[root@dev pengpengzhou] npm -v
2.15.9
发布了51 篇原创文章 · 获赞 3 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/pengpengzhou/article/details/103786099