NPM installs dependencies in a wrong place

前端 未结 2 1321
你的背包
你的背包 2020-12-02 02:20

I just run a simple npm install morgan in a folder and for some reason it adds all the sub dependencies to the parent folder. See image attached

2条回答
  •  情歌与酒
    2020-12-02 03:01

    Yes, this is a new feature in npm 3.x, you can read about it here:

    https://github.com/npm/npm/releases/tag/v3.0.0

    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.

    Basically, it now handles dependencies with as little nesting as possible.

提交回复
热议问题