cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.49k stars 3.15k forks source link

Regression of #4595 #29796

Open Usnul opened 3 weeks ago

Usnul commented 3 weeks ago

Current behavior

Explodes on checksum when installing

Desired behavior

Does not explode

Test code to reproduce

Pretty sure it's related to my slow internet speed. Not sure how to reproduce this reliably, but for me it happens pretty much every time.

Cypress Version

13.11.0

Node version

18.16.0

Operating System

Win 11 H (Version 10.0.22631 Build 22631)

Debug Logs

npm ERR! [TITLE]  Downloading Cypress      97% 2s
npm ERR! [TITLE]  Downloading Cypress      98% 1s
npm ERR! [TITLE]  Downloading Cypress      99% 1s
npm ERR! The Cypress App could not be downloaded.
npm ERR!
npm ERR! Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
npm ERR!
npm ERR! Otherwise, please check network connectivity and try again:
npm ERR!
npm ERR! ----------
npm ERR!
npm ERR! URL: https://download.cypress.io/desktop/13.11.0?platform=win32&arch=x64
npm ERR! Error: Corrupted download
npm ERR!
npm ERR! Expected downloaded file to have checksum: 0e708e7edde5151d68680c69c3f5356dd61bfc37c0c8b6fb823099f014870a9762f9a64e84336195339c0f7a7cc3a510a2a6bfbea9c4e84c841bbba6ef416ac5
npm ERR! Computed checksum: fae6117342a15b84d2af0a84086e3f3131174182ce18435b1fa1a1a109da9629b80f2d1ce18d003c51ebb3383b7159e653de78999c07a3c45f05c3d8e8104514
npm ERR!
npm ERR! Expected downloaded file to have size: 193539364
npm ERR! Computed size: 191084795
npm ERR!
npm ERR! ----------
npm ERR!
npm ERR! Platform: win32-x64 (10.0.22631)
npm ERR! Cypress Version: 13.11.0
npm ERR! [FAILED] The Cypress App could not be downloaded.
npm ERR! [FAILED]
npm ERR! [FAILED] Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
npm ERR! [FAILED]
npm ERR! [FAILED] Otherwise, please check network connectivity and try again:
npm ERR! [FAILED]
npm ERR! [FAILED] ----------
npm ERR! [FAILED]
npm ERR! [FAILED] URL: https://download.cypress.io/desktop/13.11.0?platform=win32&arch=x64
npm ERR! [FAILED] Error: Corrupted download
npm ERR! [FAILED]
npm ERR! [FAILED] Expected downloaded file to have checksum: 0e708e7edde5151d68680c69c3f5356dd61bfc37c0c8b6fb823099f014870a9762f9a64e84336195339c0f7a7cc3a510a2a6bfbea9c4e84c841bbba6ef416ac5
npm ERR! [FAILED] Computed checksum: fae6117342a15b84d2af0a84086e3f3131174182ce18435b1fa1a1a109da9629b80f2d1ce18d003c51ebb3383b7159e653de78999c07a3c45f05c3d8e8104514
npm ERR! [FAILED]
npm ERR! [FAILED] Expected downloaded file to have size: 193539364
npm ERR! [FAILED] Computed size: 191084795
npm ERR! [FAILED]
npm ERR! [FAILED] ----------
npm ERR! [FAILED]
npm ERR! [FAILED] Platform: win32-x64 (10.0.22631)
npm ERR! [FAILED] Cypress Version: 13.11.0

Other

see : https://github.com/cypress-io/cypress/issues/4595

jennifer-shehane commented 3 weeks ago

@Usnul Are you downloading 2 versions of Cypress within the same project?

Can you provide a way to reproduce this?

Usnul commented 3 weeks ago

Are you downloading 2 versions of Cypress within the same project?

I'm not sure, but looking at the package-lock.json I can only see one dependency reference and a single version.

I assume it's the same issue as before based on the appearance and the fact that Computed size is different every time.

Also, never seen that particular problem before with other packages.

Can you provide a way to reproduce this?

I don't think so, also the project in question is closed source. If it helps any, npm is version is 9.6.7

MikeMcC399 commented 3 weeks ago

@Usnul

You can try the following:

npm install --ignore-scripts

Set the environment variable DEBUG=cypress:*. Depending on whether you are using git bash / PowerShell / cmd that is one of the following:

export DEBUG=cypress:* 
$Env:DEBUG='cypress:*'
set DEBUG=cypress:*

then execute:

npx cypress cache clear
npx cypress install

That may succeed or it may just give additional debug information.

Usnul commented 2 weeks ago

Hi @MikeMcC399 ,

I changed the version to 13.3.0, and the error went away.

Can you describe how you connect to the Internet? Is this a personal / mobile / corporate network?

It's a 5G connection, using a very decent ZTE router. The issue is that signal to noise ratio is too high and I lose a lot of packets. This doesn't really lead to data corruption, it just creates a lot of disconnection events across the network stack, from micro-stutter during voice calls where signal drops out for 100ms, up to router losing signal and internet dropping out entirely for a few seconds.

Generally, I don't have a problem downloading, say a 1Gb file from the browser. I work a lot with NPM-based projects, and I've never had this kind of an issue either. Hope this is detailed enough.

According to your log file, your download is 99% complete. This means that it is missing the end of the file.

My internet is bad, but I don't think it's so bad as to always miss the end of the file, or that the machinery for download is so bad that it mistakes missing data for completion.

MikeMcC399 commented 2 weeks ago

@Usnul

Thanks for describing your network connection! It sounds like the download process, which uses Node.js, may not be coping with the network reliability.

Is Cypress 13.3.0 sufficient for your needs or do you need to use Cypress 13.11.0 (or a later version)?

If you are able to download the complete Cypress binary (cypress.zip) in a web browser it should be possible to unzip this into the Cypress cache location for Windows, which is a version-specific directory %LOCALAPPDATA%\Cypress\Cache\<Cypress version> you would need to create.

https://download.cypress.io/desktop/13.11.0?platform=win32&arch=x64 downloads the specific version https://download.cypress.io gets you the latest

See https://docs.cypress.io/guides/references/advanced-installation#Download-URLs