相关疑难解决方法(0)

节点包管理器(NPM)似乎产生了重复的包

我一直在安装一些节点包,我注意到的是NPM创建了一堆重复项.

例如,我首先安装了mongoose,它自然地安装了一堆依赖项.然后我安装了mongodb软件包,它也带有bson作为依赖项.由于重叠依赖,我有以下异常:

Mongodb存在于以下目录中:

/usr/local/lib/node_modules/mongodb/
/usr/local/lib/node_modules/mongoose/node_modules/mongodb/
Run Code Online (Sandbox Code Playgroud)

另外,bson,mongodb的依赖关系存在于这两个方面:

/usr/local/lib/node_modules/mongodb/
/usr/local/lib/node_modules/mongoose/node_modules/mongodb/
Run Code Online (Sandbox Code Playgroud)

我意识到这些只是千字节的文件,但我觉得这可能会产生很多冗余,最终我可能会得到一个非常复杂的树,类似于以下内容:

/usr/local/lib/node_modules/[something1]/node_modules/[something2]/node_modules/[something3/.../.../node_modules/[somethingX]/
Run Code Online (Sandbox Code Playgroud)

在这种情况下,给定的[dependency]可能出现在/ usr/local/lib/node_modules下的X级别上.

我主要关心的是更新这些模块.我不觉得很难想象同时安装不同版本的并发模块.

将所有内容直接放在/ usr/local/lib/node_modules /然后交叉引用依赖项会不会更容易?

module node.js npm

5
推荐指数
1
解决办法
2307
查看次数

标签 统计

module ×1

node.js ×1

npm ×1