当我执行 npm install 时,Node js 添加不需要的模块 [英] Node js adding unwanted modules when I do npm install

查看:43
本文介绍了当我执行 npm install 时,Node js 添加不需要的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 Mac 上启动节点服务.当我在我的节点服务所在的文件夹中运行 npm install 时,它正在安装我的 package.json 中没有提到的模块.有一些我不期望的额外模块和一些我期望的模块丢失了.可能是什么原因?如何创建节点模块文件夹.它是否使用任何全局设置?我是 nodejs 的新手,任何帮助将不胜感激.

解决方案

嗯,npm3 已经引入了 (https://github.com/npm/npm/blob/master/CHANGELOG.md#v300-2015-06-25):><块引用>

平,平,平!

您的依赖项现在将被最大程度地安装.就目前而言可能的,您所有的依赖项,以及它们的依赖项,以及它们的依赖项将安装在您项目的 node_modules 文件夹中没有嵌套.您只会看到相互嵌套的模块当两个(或更多)模块有冲突的依赖时.

I am trying to spin up a node service on my mac. When I run npm install in the folder where my node service is, it is installing modules which are not mentioned in my package.json. There are extra modules which I am not expecting and some modules that I expect are missing. What could be the reason? How does the node modules folder get created. Does it use any global set up? I am a newbie to nodejs and any help will be appreciated.

解决方案

Well, it has been introduced with npm3 (https://github.com/npm/npm/blob/master/CHANGELOG.md#v300-2015-06-25):

Flat, flat, flat!

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.

这篇关于当我执行 npm install 时,Node js 添加不需要的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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