Peer dependency issue - @cypress/webpack-preprocessor doesn't support webpack@^5
See original GitHub issueCurrent behavior
Installation of @cypress/react fails due to unresolved peer dependency.
Pre-existing install of webpack 5 & react 17
From a repository with the following packages:
"dependencies": {
"html-webpack-plugin": "^5.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"webpack": "^5.36.2",
"webpack-cli": "^4.7.0",
"webpack-dev-server": "^3.11.2"
}
when running the cypress guide command (minus webpack-dev-server):
npm install --save-dev cypress @cypress/react @cypress/webpack-dev-server
install fails with error: “Enable to resolve dependency tree” (see below screenshot) The culprit seems to be @cypress/webpack-preprocessor which can’t support a webpack version greater than 4.
Pre-existing install of react 17 only
From an empty repository, the install fails due to html-webpack-plugin ^5.3.1 needing webpack 5 rather than webpack 4
command
npm install --save-dev cypress @cypress/react @cypress/webpack-dev-server webpack-dev-server
Logs
Pre-existing install of react 17 & html-webpack-plugin 4
From the only the following repository, the install works:
"dependencies": {
"html-webpack-plugin": "^4.5.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
}
command
npm install --save-dev cypress @cypress/react @cypress/webpack-dev-server webpack-dev-server
Logs
Environment
- node: v14.16.0
- npm: v7.11.2
- Mac OS Big Sur version 11.3
Expected behavior
Clean install with support for webpack 5
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Webpack 5 support · Issue #8900 · cypress-io/cypress - GitHub
I've been using cypress-webpack-preprocessor with webpack 5 now for a bit and the only issue for us is the peer dependency warning. It...
Read more >cypress-webpack-preprocessor-v5 - npm package - Snyk
This package relies on the following peer dependencies: @babel/core; @babel/preset-env; babel-loader; webpack. It is likely you already have ...
Read more >@cypress/webpack-preprocessor - npm
Cypress preprocessor for bundling JavaScript via webpack. Latest version: 5.16.0, last published: 9 days ago.
Read more >Migration Guide | Cypress Documentation
Migrating to Cypress 12.0 This guide details the changes and how to change your code to migrate to Cypress version 12.0.
Read more >Problem setting up Cypress component tests for CRA with ...
@import '~src/styles/variables';. I'm not too familiar with Webpack so I'm not sure why this error is happening. :( The actual test for 1 ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lmiller1990 thanks for the very reactive fix. I tested the install on my side and all seems to work with the exact command suggested by your guide. Thanks!
Fixed in #16412,
@cypress/react": "^5.6.0"
. It’s been released. I re-ran the above command and it worked.