Can't install cypress/react
See original GitHub issueInstalling @cypress/react
even in a fresh npm project fails
Current behavior
npm i --save-dev @cypress/react
fails with this error message:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cypress-tests@1.0.0
npm ERR! Found: webpack@5.25.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@">=2" from babel-loader@8.2.2
npm ERR! node_modules/babel-loader
npm ERR! peerOptional babel-loader@"^=8.x" from @cypress/react@4.16.4
npm ERR! node_modules/@cypress/react
npm ERR! dev @cypress/react@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional webpack@"^=3.x" from @cypress/react@4.16.4
npm ERR! node_modules/@cypress/react
npm ERR! dev @cypress/react@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/nilsmartel/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nilsmartel/.npm/_logs/2021-03-12T09_19_37_930Z-debug.log
Download method
- npm 7.5.3
Operating System
- Linux
- Mac
- Windows
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Installing - Cypress Documentation
This will install Cypress locally as a dev dependency for your project. Make sure that you have already run npm init or have...
Read more >@cypress/react - npm
Test React components using Cypress. Latest version: 7.0.2, last published: 24 days ago. Start using @cypress/react in your project by ...
Read more >Can't resolve '@cypress/react/support' using v5.7 · Issue #16471
After upgrading @cypress/react from v4.16 to v5.7, starting cypress yields: Error: Webpack Compilation Error ./cypress/support/index.js ...
Read more >Module not found: Error: Can't resolve 'cypress-react-selector'
I am trying to use @cypress/react and I followed the installation instructions. In addition, I have also installed Cypress Testing Library ...
Read more >Set up Cypress in your React Project - DEV Community
npm install -D cypress => install Cypress as dev dependency · You can create a script in package.json to open cypress:.
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 Free
Top 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
@jennifer-shehane, so my team and I have actually looked into this one - here’s our learnings:
As i understand it, the issue happens when using npm 7 to install
@cypress/react
, and this happens because npm 7 no longer has --legacy-peer-deps turned on by default. Please try installing@cypress/react
using npm 7.x and you will see these errors.@cypress/react
’s current (develop
branch)package.json
specifies thatwebpack 3.x
is a peer dependency. I think this is the root of the problem (at least for@cypress/react
). https://github.com/cypress-io/cypress/blob/a12928496610743b8ac77a7fe17a8a2794f7e77a/npm/react/package.json#L108I believe you are already telling ppl as part of ur docs, that component testing requires webpack 4 or 5 (https://docs.cypress.io/guides/component-testing/introduction#Prerequisites). Could I suggest the above peer-dep be changed to:
It should be noted that various other packages (eg
@cyprss/webpack-preprocessor
&@cypress/webpack-dev-server
) also specify things like:I wonder, could you guys agree on a webpack support range (sounds like you already have, and it’s 4.x - 5.x) - and fix these definitions across all the cypress npm component package.json’s? 🙏
I’m getting the web pack dependency error and I’m running Cypress 7.0.0. Trying to install it with vite-dev-server 1.2.0. I even tried with the webpack-dev-server. My app is React 17.0.1 with Vite 2.0.5.