NPM 在错误的地方安装依赖项 [英] NPM installs dependencies in a wrong place

查看:30
本文介绍了NPM 在错误的地方安装依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在一个文件夹中运行一个简单的 npm install morgan 并且出于某种原因它将所有子依赖项添加到父文件夹中.见附图

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

推荐答案

是的,这是 npm 3.x 中的一个新特性,你可以在这里阅读:

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

您的依赖项现在将安装最平坦.在可能的情况下,您的所有依赖项及其依赖项以及它们的依赖项将无嵌套地安装在您项目的 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.

基本上,它现在以尽可能少的嵌套处理依赖项.

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

这篇关于NPM 在错误的地方安装依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆