【问题标题】:How to resolve yarn warnings如何解决纱线警告
【发布时间】:2021-07-08 03:01:08
【问题描述】:

我使用 vue cli 创建了一个新项目。 这个项目是一个带有 Ant Design、Vue Router 和 Eslint 的 Vue3。 但是,当我发出 yarn 命令时,它会向我显示以下警告。

yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@vue/eslint-config-airbnb > eslint-import-resolver-webpack@0.13.0" has unmet peer dependency "webpack@>=1.11.0".
warning " > less-loader@7.3.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
[4/4] Building fresh packages...
Done in 26.91s.

我注意到的 webpack 已经直接安装在 vue 3 上。如何解决这些警告?

【问题讨论】:

  • 你试过用 npm 代替 yarn。
  • 在你的 package.json 依赖项上添加 peerDependancies

标签: vue.js webpack eslint yarnpkg less-loader


【解决方案1】:

对于 fsevents,它似乎是一个仅适用于 MacOS 的库,因此这可能解释了您遇到第一个错误的原因。

对于 peer 依赖项和 webpack,如果您使用 Yarn,您似乎必须执行 yarn add webpack --peer 或正如 @kaumadie 在评论中所说,您也可以直接将其添加到 package .json 项目的文件

使用 npm,您可以直接在项目文件夹中执行npm i,它应该会自动解决所有对等依赖项

希望对您有所帮助,祝您有美好的一天!

【讨论】:

  • 它不起作用,所以看起来 vue cli 已经使用 package.json 中没有出现的 webpack 版本创建了项目。此版本导致此警告。
猜你喜欢
  • 2013-04-29
  • 1970-01-01
  • 2012-06-14
  • 2017-11-22
  • 1970-01-01
  • 1970-01-01
  • 2021-10-08
  • 2019-07-13
相关资源
最近更新 更多