gpt4 book ai didi

node.js - npm Express install 正在添加额外的依赖项

转载 作者:太空宇宙 更新时间:2023-11-03 23:33:34 25 4
gpt4 key购买 nike

当我 cd 进入我的项目并 npm installexpress --save 时,它​​不仅将express注入(inject)到我的node_modules中,而且还安装了许多我不需要或不想要的其他依赖项。我尝试卸载并重新安装node和npm。我正在使用自制程序来安装 Node 。有人可以帮助我理解为什么会发生这种情况吗?

npm install express --save

 ─┬ express@4.13.4 
├─┬ accepts@1.2.13
│ ├─┬ mime-types@2.1.9
│ │ └── mime-db@1.21.0
│ └── negotiator@0.5.3
├── array-flatten@1.1.1
├── content-disposition@0.5.1
├── content-type@1.0.1
├── cookie@0.1.5
├── cookie-signature@1.0.6
├─┬ debug@2.2.0
│ └── ms@0.7.1
├── depd@1.1.0
├── escape-html@1.0.3
├── etag@1.7.0
├─┬ finalhandler@0.4.1
│ └── unpipe@1.0.0
├── fresh@0.3.0
├── merge-descriptors@1.0.1
├── methods@1.1.2
├─┬ on-finished@2.3.0
│ └── ee-first@1.1.1
├── parseurl@1.3.1
├── path-to-regexp@0.1.7
├─┬ proxy-addr@1.0.10
│ ├── forwarded@0.1.0
│ └── ipaddr.js@1.0.5
├── qs@4.0.0
├── range-parser@1.0.3
├─┬ send@0.13.1
│ ├── destroy@1.0.4
│ ├─┬ http-errors@1.3.1
│ │ └── inherits@2.0.1
│ ├── mime@1.3.4
│ └── statuses@1.2.1
├── serve-static@1.10.2
├─┬ type-is@1.6.11
│ └── media-typer@0.3.0
├── utils-merge@1.0.0
└── vary@1.0.1

最佳答案

您可能正在运行 npm 版本 3 或更高版本。这个版本使得依赖项的所有依赖项都存储在根node_modules文件夹中。

请参阅此处了解更多信息: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.

关于node.js - npm Express install 正在添加额外的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35320084/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com