gpt4 book ai didi

npm - 全局安装具有对等依赖关系的 npm 包(package.json 中未提及)

转载 作者:行者123 更新时间:2023-12-04 11:46:11 24 4
gpt4 key购买 nike

我正在尝试安装 marktext全局使用 npm(克隆存储库后):

npm install -g
npm WARN dagre-d3-renderer@0.5.8 requires a peer of d3@^4.13.0 but none is installed. You must install peer dependencies yourself.
我应该如何安装全局包的对等依赖项?请给出命令,以确保安全并防止将来发生冲突。

我做了 npm install -g d3@^4.13.0但我仍然遇到同样的错误。

这是全局安装依赖项的好主意吗?另外,我是否需要在全局版本中锁定它以防止在进行全局更新时自动更新?

最佳答案

升级试试 npm到版本 7

npm install -g npm@7
npm 7 带来了新功能。其中之一是自动安装对等依赖项。

Automatically installing peer dependencies: prior to npm 7 developers needed to manage and install their own peer dependencies. The new peer dependency algorithm ensures that a validly matching peer dependency is found at or above the peer-dependent’s location in the node_modules tree.

关于npm - 全局安装具有对等依赖关系的 npm 包(package.json 中未提及),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53890867/

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