Vue使用vis-network 遇到的问题

使用vis-network
通过npm安装,遇到问题:

先是在vs code中安装:

'opencollective' 不是内部或外部命令,也不是可运行的程序

这个是什么问题?

后来,改成使用管理员权限,在命令行中安装:

npm WARN vis-network@7.10.1 requires a peer of @egjs/hammerjs@^2.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN vis-network@7.10.1 requires a peer of keycharm@^0.2.0 || ^0.3.0 but none is installed. You must install peer dependencies yourself.

npm WARN vis-network@7.10.1 requires a peer of moment@^2.24.0 but none is installed. You must install peer dependencies yourself.

npm WARN vis-network@7.10.1 requires a peer of vis-data@^6.2.1 but none is installed. You must install peer dependencies yourself.

npm WARN vis-network@7.10.1 requires a peer of vis-util@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\webpack-dev-server\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\watchpack\node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

up to date in 9.759s

58 packages are looking for funding

run `npm fund` for details

这些warn是怎么回事?该怎么解决?

回答

peerDependencies 表示你需要显式的依赖这些项。

比如你依赖了 A,A 又依赖了 B,(在 A 的 package.json 的 dependencies里),那么当你安装 A 的时候,也会自动安装 B。

但如果还是上面这样的依赖,却在 A 的 package.json 的 peerDependencies 里,那么你安装 A 之前,必须先手动安装 B,npm 是不会帮你自动安装的。

这样的目的是统一使用你自己项目来管理依赖项版本,避免版本冲突问题。

以上是 Vue使用vis-network 遇到的问题 的全部内容, 来源链接: utcz.com/a/34834.html

回到顶部