Using Webpack and cypress react



我似乎无法在使用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.

我无法独自解决这个问题。

为了重现问题,只需

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

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

最新更新