【问题标题】:Using Webpack and cypress react使用 Webpack 和 cypress react
【发布时间】:2021-06-09 12:33:37
【问题描述】:

看来我不能在使用 Webpack 的项目中使用 @cypress/react。 每次我尝试安装它时,都会收到以下错误消息:

while resolving: min-working-example@1.0.0
Found: webpack@5.24.4
node_modules/webpack
  dev webpack@"*" from the root project
  peer webpack@">=2" from babel-loader@8.2.2
  node_modules/babel-loader
    peerOptional babel-loader@"^=8.x" from @cypress/react@4.16.4
    node_modules/@cypress/react
      dev @cypress/react@"*" from the root project

Could not resolve dependency:
peerOptional webpack@"^=3.x" from @cypress/react@4.16.4
node_modules/@cypress/react
  dev @cypress/react@"*" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

我无法自行解决此问题。

为了重现问题,只需

  • 创建amn空目录,执行npm init
  • npm i --save-dev Webpack cypress @cypress/react

【问题讨论】:

  • 你试过 npm 审计吗
  • 这是个好主意,但我什至无法安装它。我认为我需要在源代码中对此进行一些跟踪,才能开始进行审计

标签: node.js npm webpack dependencies cypress


【解决方案1】:

您可以使用错误消息最后几行中概述的 legacy-peer-deps 开关来解决此问题。这并不理想,但您应该能够使其工作,直到两个模块之间的对等依赖项对齐。

【讨论】:

    猜你喜欢
    • 2019-09-08
    • 2020-10-31
    • 2021-07-18
    • 2022-08-19
    • 2018-02-09
    • 2019-03-04
    • 2016-09-14
    • 2020-03-28
    • 2023-02-11
    相关资源
    最近更新 更多