Upgrade Cypress to latest version not working without force install

Viewed 10838

I have just upgraded Cypress using npm install cypress -D and got the below error

up to date, audited 775 packages in 1s

18 packages are looking for funding   
  run `npm fund` for details

found 0 vulnerabilities
PS C:\Repositories\XXX-testautomation> npx cypress open
It looks like this is your first time using Cypress: 7.2.0

  ×  Verifying Cypress can run C:\Users\<UN>\AppData\Local\Cypress\Cache\7.2.0\Cypress
    → Cypress Version: 7.2.0
Cypress failed to start.

This is usually caused by a missing library or dependency.

The error below should indicate which dependency is missing.

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.


Platform: win32 (10.0.19042)
Cypress Version: 7.2.0

But when I perform force install, I am able to see the confirmation that the install was successful and I was able to open cypress without any issues.

npx cypress install --force

Cypress 7.2.0 is installed in C:\Users\<UN>\AppData\Local\Cypress\Cache\7.2.0

Installing Cypress (version: 7.2.0)

  √  Downloaded Cypress
  √  Unzipped Cypress
  √  Finished Installation C:\Users\<UN>\AppData\Local\Cypress\Cache\7.2.0

You can now open Cypress by running: node_modules\.bin\cypress open

https://on.cypress.io/installing-cypress

PS C:\Repositories\xxx-testautomation> npx cypress open
It looks like this is your first time using Cypress: 7.2.0

  √  Verified Cypress! C:\Users\<UN>\AppData\Local\Cypress\Cache\7.2.0\Cypress

Opening Cypress...

Can someone explain why it always needs a --force command?

3 Answers

Sometimes I run at the same problem and I use the this guideline and run commands in this sequence that usually helps:

cypress cache clear
npm install cypress --save-dev

During an upgrade, it may be missed to clean up cache files. If any issue with the upgrade try to do cache clear (using $cypress cache clear command) or find the cache path using $cypress cache path command clear it manually then install cypress $ npm install cypress --save-dev

npx executes binaries from npm packages and it won't install. Refer the diff

npx used only for launch the packages, not for install. Also I faced issue with install the version 7.1.0 - enabled vpn crash my installation. After disabling vpn - installed the cypress successfully. Maybe the problems with connection? Try to use the 7.1.0 version.

Related