cypress-io / cypress

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

The Cypress App could not be unzipped #16631

Closed Anubhavkol11 closed 1 year ago

Anubhavkol11 commented 3 years ago
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> cypress@7.3.0 postinstall C:\Users\Lenovo s540\CypressAutomation\node_modules\cypress
> node index.js --exec install

Installing Cypress (version: 7.3.0)

  √  Downloaded Cypress
  ×  Unzipping Cypress
    → Cypress Version: 7.3.0
     Finishing Installation
The Cypress App could not be unzipped.

Search for an existing issue or open a GitHub issue at

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

----------

Error: end of central directory record signature not found

----------

Platform: win32 (10.0.19042)
Cypress Version: 7.3.0
npm WARN cypressautomation@1.0.0 No description
npm WARN cypressautomation@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress@7.3.0 postinstall: `node index.js --exec install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress@7.3.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Lenovo s540\AppData\Roaming\npm-cache\_logs\2021-05-22T08_58_51_272Z-debug.log
jennifer-shehane commented 3 years ago

We used to see this issue documented here: https://github.com/cypress-io/cypress/issues/3515 But haven't seen it in a while.

kakashy commented 3 years ago

Ran into this with npm i -D cypress using two different node versions: v14.0.0 and v16.0.1. Any fix?

Jeffintel commented 2 years ago

hi @jennifer-shehane, This is also happening in version: 8.7.0

Installing Cypress (version: 8.7.0)

[STARTED] Task without title.
[SUCCESS] Task without title.
[STARTED] Task without title.
[FAILED] The Cypress App could not be unzipped.
[FAILED] 
[FAILED] Search for an existing issue or open a GitHub issue at
TheSharpieOne commented 2 years ago

Not sure if this information is helpful or not, but I am running into this with a monorepo. I recently migrated several applications into a yarn workspace monorepo. Some of the applications have the same version of cypress, some have a different version. Running yarn on circle ci results in various issues around downloading and/or unzipping cypress (probably not happening locally since each version was previously installed individually before migrating to the monorepo). Some of the error messages I have seen (expand for more output):

Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/6.9.1/Cypress/resources/app/packages/server-ct/node_modules/lodash/_baseIsTypedArray.js' ``` error /root/project/node_modules/@cypress/code-coverage/node_modules/cypress, /root/project/node_modules/@testing-library/cypress/node_modules/cypress, /root/project/packages/amber/node_modules/cypress, /root/project/packages/member-portal-ui/node_modules/@cypress/code-coverage/node_modules/cypress, /root/project/packages/paid-community/node_modules/@cypress/code-coverage/node_modules/cypress: Command failed. Exit code: 1 Command: node index.js --exec install Arguments: Directory: /root/project/node_modules/@cypress/code-coverage/node_modules/cypress Output: [17:34:17] Downloading Cypress [started] [17:34:34] Downloading Cypress [completed] [17:34:34] Unzipping Cypress [started] [17:34:58] Unzipping Cypress [failed] The Cypress App could not be unzipped. Search for an existing issue or open a GitHub issue at https://github.com/cypress-io/cypress/issues ---------- Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/6.9.1/Cypress/resources/app/packages/server-ct/node_modules/lodash/_baseIsTypedArray.js' ---------- Platform: linux (Debian - 10.8) Cypress Version: 6.9.1 ```

Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/node_modules/yargs/locales/th.json' ``` error /root/project/packages/frost/node_modules/cypress, /root/project/packages/leader-signup/node_modules/@testing-library/cypress/node_modules/cypress, /root/project/packages/marketing-cloud-integration/node_modules/@testing-library/cypress/node_modules/cypress, /root/project/packages/member-portal-ui/node_modules/@testing-library/cypress/node_modules/cypress, /root/project/packages/mgu-embed/node_modules/@testing-library/cypress/node_modules/cypress: Command failed. Exit code: 1 Command: node index.js --exec install Arguments: Directory: /root/project/packages/mgu-embed/node_modules/@testing-library/cypress/node_modules/cypress Output: [STARTED] Task without title. [SUCCESS] Task without title. [STARTED] Task without title. [FAILED] The Cypress App could not be unzipped. [FAILED] [FAILED] Search for an existing issue or open a GitHub issue at [FAILED] [FAILED] https://github.com/cypress-io/cypress/issues [FAILED] [FAILED] ---------- [FAILED] [FAILED] Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/node_modules/yargs/locales/th.json' [FAILED] [FAILED] ---------- [FAILED] [FAILED] Platform: linux (Debian - 10.8) [FAILED] Cypress Version: 7.7.0 The Cypress App could not be unzipped. Search for an existing issue or open a GitHub issue at https://github.com/cypress-io/cypress/issues ---------- Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/node_modules/yargs/locales/th.json' ---------- Platform: linux (Debian - 10.8) Cypress Version: 7.7.0 ```

Expected downloaded file to have checksum: 90012cdfc2823eba1921e9ed72e8e2156f409cbbc63d5918bf062b176f4f5e4467869cac609da02f75a229d402ee9acd52ea7fae8504c73196f2e98cbf002c6f Computed checksum: 38a7057a9e6edc43256e369e4115dd132c59e9d8ac4121a57763034e9414e7ea27f157f32722ce9ef70f54e082ea5b8e67731398280d15794d7a79adbca1d681 ``` error /root/project/packages/member-portal-ui/node_modules/cypress, /root/project/packages/paid-community/node_modules/cypress: Command failed. Exit code: 1 Command: node index.js --exec install Arguments: Directory: /root/project/packages/paid-community/node_modules/cypress Output: [17:36:22] Downloading Cypress [started] [17:36:26] Downloading Cypress [failed] The Cypress App could not be downloaded. 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 Otherwise, please check network connectivity and try again: ---------- URL: https://download.cypress.io/desktop/5.6.0?platform=linux&arch=x64 Error: Corrupted download Expected downloaded file to have checksum: 90012cdfc2823eba1921e9ed72e8e2156f409cbbc63d5918bf062b176f4f5e4467869cac609da02f75a229d402ee9acd52ea7fae8504c73196f2e98cbf002c6f Computed checksum: 38a7057a9e6edc43256e369e4115dd132c59e9d8ac4121a57763034e9414e7ea27f157f32722ce9ef70f54e082ea5b8e67731398280d15794d7a79adbca1d681 Expected downloaded file to have size: 205241643 Computed size: 205241643 ---------- Platform: linux (Debian - 10.8) Cypress Version: 5.6.0 ```

There are several more like the first one, just with different versions and/or different missing files.

Individually/independently, before being combined into workspace / monorepo, these all worked.

To me, not really knowing how yarn works and how the download / install works, but for the checksum it seems like a race condition where the zip file is either being created or removed while another install is trying to access it. I see it uses process.pid when naming the zip, I just don't know if yarn workspace is creating a new process for each install or not. If it doesn't, that would definitely lead to collisions.

Maybe for the missing files maybe one install determines that the cache is there and tries to use it as another install is unzipping the cache (so the files are not all there yet and thus, depending on the exact timing, a different file is missing and causes the error)

marcosaguilera-glober commented 2 years ago

I was getting same issue: # EACCES: permission denied, mkdir '/root/.cache/Cypress'

I've fixed like this:

  1. In my Dockerfile
    
    #Cypress version using
    FROM cypress/included:10.6.0

Installing sudo for superower installation required

into entrypoint.sh

RUN apt-get install sudo

Directories actions

WORKDIR /home/pwsh/tempVolume

ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]


2. In my entrypoint.sh script file

!/bin/sh

echo "I'm into the sh file"

Install packages defined into package.json > dependencies node

npm install

sudo npm install --unsafe-perm=true --allow-root

Run cypress

cypress run


I messed up a time with this issue, and I tried with permissions `chown node:node`, also some `chmod -R 777`, but nothing worked for me, so I installed `sudo apt-get` into Linux distro.

Hope this help anyone.
geminiyellow commented 1 year ago

any change?

i got something like this

error /drone/src/node_modules/cypress, /drone/src/test/e2e/node_modules/cypress: Command failed.
91Exit code: 1
92Command: node index.js --exec install
93Arguments: 
94Directory: /drone/src/test/e2e/node_modules/cypress
95Output:
96Installing Cypress (version: 12.3.0)
97
98[STARTED] Task without title.
99[SUCCESS] Task without title.
100[STARTED] Task without title.
101[FAILED] The Cypress App could not be unzipped.
102[FAILED] 
103[FAILED] Search for an existing issue or open a GitHub issue at
104[FAILED] 
105[FAILED] https://github.com/cypress-io/cypress/issues
106[FAILED] 
107[FAILED] ----------
108[FAILED] 
109[FAILED] Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/12.3.0/Cypress/locales/fil.pak'
110[FAILED] 
111[FAILED] ----------
112[FAILED] 
113[FAILED] Platform: linux-x64 (Debian - 10)
114[FAILED] Cypress Version: 12.3.0
115The Cypress App could not be unzipped.
116
117Search for an existing issue or open a GitHub issue at
118
119https://github.com/cypress-io/cypress/issues 
mankittens commented 1 year ago

We're running into fails like the above poster's in our CI system:

.../core-js@3.21.1/node_modules/core-js postinstall$ node -e "try{require('./postinstall')}catch(e){}"
.../core-js@3.21.1/node_modules/core-js postinstall: Done
.../node_modules/core-js-pure postinstall$ node -e "try{require('./postinstall')}catch(e){}"
.../core-js@3.29.1/node_modules/core-js postinstall$ node -e "try{require('./postinstall')}catch(e){}"
.../node_modules/core-js-pure postinstall: Done
.../core-js@3.29.1/node_modules/core-js postinstall: Done
.../node_modules/@parcel/watcher install$ node-gyp-build
.../node_modules/@parcel/watcher install: Done
.../esbuild@0.17.14/node_modules/esbuild postinstall$ node install.js
.../esbuild@0.17.14/node_modules/esbuild postinstall: Done
.../esbuild@0.16.17/node_modules/esbuild postinstall$ node install.js
.../esbuild@0.16.17/node_modules/esbuild postinstall: Done
.../.pnpm/nx@15.8.9/node_modules/nx postinstall$ node ./bin/compute-project-graph
.../.pnpm/nx@15.8.9/node_modules/nx postinstall: Done
.../cypress@11.1.0/node_modules/cypress postinstall$ node index.js --exec install
.../cypress@11.1.0/node_modules/cypress postinstall: [STARTED] Task without title.
.../node_modules/@sentry/cli install$ node ./scripts/install.js
.../node_modules/@sentry/cli install: [sentry-cli] Downloading from https://downloads.sentry-cdn.com/sentry-cli/1.75.2/sentry-cli-Linux-x86_[64](https://gitlab.com/HealthTensor/automed/-/jobs/4738143727#L64)
.../node_modules/@sentry/cli install: [sentry-cli] Checksum validation passed.
.../node_modules/@sentry/cli install: Done
.../cypress@11.1.0/node_modules/cypress postinstall$ node index.js --exec install
.../cypress@11.1.0/node_modules/cypress postinstall: [STARTED] Task without title.
.../cypress@11.1.0/node_modules/cypress postinstall: [SUCCESS] Task without title.
.../cypress@11.1.0/node_modules/cypress postinstall: [STARTED] Task without title.
.../cypress@11.1.0/node_modules/cypress postinstall: [SUCCESS] Task without title.
.../cypress@11.1.0/node_modules/cypress postinstall: [STARTED] Task without title.
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] The Cypress App could not be unzipped.
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] 
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] Search for an existing issue or open a GitHub issue at
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] 
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] https://github.com/cypress-io/cypress/issues
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] 
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] ----------
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] 
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/11.1.0/Cypress/resources/app/node_modules/xml-parse-from-string/package.json'
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] 
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] ----------
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] 
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] Platform: linux-x64 (Debian - 11.4)
.../cypress@11.1.0/node_modules/cypress postinstall: [FAILED] Cypress Version: 11.1.0
.../cypress@11.1.0/node_modules/cypress postinstall: The Cypress App could not be unzipped.
.../cypress@11.1.0/node_modules/cypress postinstall: Search for an existing issue or open a GitHub issue at
.../cypress@11.1.0/node_modules/cypress postinstall: https://github.com/cypress-io/cypress/issues
.../cypress@11.1.0/node_modules/cypress postinstall: ----------
.../cypress@11.1.0/node_modules/cypress postinstall: Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/11.1.0/Cypress/resources/app/node_modules/xml-parse-from-string/package.json'
.../cypress@11.1.0/node_modules/cypress postinstall: ----------
.../cypress@11.1.0/node_modules/cypress postinstall: Platform: linux-x64 (Debian - 11.4)
.../cypress@11.1.0/node_modules/cypress postinstall: Cypress Version: 11.1.0
.../cypress@11.1.0/node_modules/cypress postinstall: Failed

It's proving very difficult to debug...

The failure doesn't happen all the time but enough of the time to be frustrating.

MikeMcC399 commented 1 year ago

@mankittens

It's proving very difficult to debug...

The failure doesn't happen all the time but enough of the time to be frustrating.

These are the hardest types of errors to find and fix!

Your error is

"Error: ENOENT: no such file or directory, open '/root/.cache/Cypress/11.1.0/Cypress/resources/app/node_modules/xml-parse-from-string/package.json'"

which is not the same as the error in the original post, nor is it the same as the previous poster.

Which CI provider are you using?

chris-mo commented 1 year ago

i'm running into this also within a yarn workspaces monorepo. we have run into this for both version 12.14.0 and 12.17.3

out of curiosity, why is there a label "needs reproduction"? Seems like previous posters have provided decent info. is there any more info/stack trace we can provide to help this along?

MikeMcC399 commented 1 year ago

@chris-mo

Are you facing a hard error condition or an intermittent condition?

Does this happen when you install manually locally or is it happening in a CI workflow? If yes, what is the name of the CI provider?

Could you post your full postinstall log please?

chris-mo commented 1 year ago

@MikeMcC399 intermittent. it happens during CI often, i'd say daily but not the majority of the time. we typically restart the job and it'll succeed the following attempt. we're using Jenkins

➤ YN0000: │ cypress@npm:12.14.0 STDOUT You can now open Cypress by running: node_modules/.bin/cypress open

➤ YN0000: │ cypress@npm:12.14.0 STDOUT 

➤ YN0000: │ cypress@npm:12.14.0 STDOUT https://on.cypress.io/installing-cypress

➤ YN0000: │ cypress@npm:12.14.0 STDOUT 

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] The Cypress App could not be unzipped.

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] 

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] Search for an existing issue or open a GitHub issue at

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] 

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] https://github.com/cypress-io/cypress/issues

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] 

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] ----------

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] 

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] Error: ENOENT: no such file or directory, open '/var/lib/jenkins/.cache/Cypress/12.14.0/Cypress/resources/app/packages/server/node_modules/uuid/dist/esm-node/version.js'

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] 

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] ----------

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] 

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] Platform: linux-x64 (Ubuntu - 22.04)

➤ YN0000: │ cypress@npm:12.14.0 STDERR [FAILED] Cypress Version: 12.14.0

➤ YN0000: │ cypress@npm:12.14.0 STDOUT The Cypress App could not be unzipped.

➤ YN0000: │ cypress@npm:12.14.0 STDOUT 

➤ YN0000: │ cypress@npm:12.14.0 STDOUT Search for an existing issue or open a GitHub issue at

➤ YN0000: │ cypress@npm:12.14.0 STDOUT 

➤ YN0000: │ cypress@npm:12.14.0 STDOUT https://github.com/cypress-io/cypress/issues

➤ YN0000: │ cypress@npm:12.14.0 STDOUT 

➤ YN0000: │ cypress@npm:12.14.0 STDOUT ----------

➤ YN0000: │ cypress@npm:12.14.0 STDOUT 

➤ YN0000: │ cypress@npm:12.14.0 STDOUT Error: ENOENT: no such file or directory, open '/var/lib/jenkins/.cache/Cypress/12.14.0/Cypress/resources/app/packages/server/node_modules/uuid/dist/esm-node/version.js'

➤ YN0000: │ cypress@npm:12.14.0 STDOUT 

➤ YN0000: │ cypress@npm:12.14.0 STDOUT ----------

➤ YN0000: │ cypress@npm:12.14.0 STDOUT 

➤ YN0000: │ cypress@npm:12.14.0 STDOUT Platform: linux-x64 (Ubuntu - 22.04)

➤ YN0000: │ cypress@npm:12.14.0 STDOUT Cypress Version: 12.14.0
MikeMcC399 commented 1 year ago

@chris-mo

Thank you very much for your logs! Comparing your report to the other reports, they are each failing at different points.

There was an interesting insight in https://github.com/cypress-io/cypress/issues/16631#issuecomment-982830076 which suggested that there might be some cache overwriting causing the issue. That could explain why it is difficult to reproduce because it would depend on individual customer-specific workflows. I have never seen this issue in any of the example Cypress repositories. These are running typically with CircleCI and GitHub Actions as CI providers.

Normally if the downloaded cypress.zip file were corrupt it would immediately fail with a checksum error, but that is not happening here.

We had another issue where the cypress.zip file was being downloaded from a wrongly-configured mirror repository, and it was trying to install a zip file for the wrong architecture and then failing. (See Win 10 - symlink - operation not permitted, symlink.) The same file name cypress.zip is used for every target architecture. It might be possible to check that the right file is being used by manually downloading a specific version / architecture manually (see Download URLs) and checking that the file sizes and CRC for the zip file match what is being used in the CI workflow.

Maybe somebody else has some other ideas about how to troubleshoot this issue?

MikeMcC399 commented 1 year ago

I did a quick check of installing wrong architectures on Ubuntu 22.04 and I did not get any unzip errors. Cypress just failed to verify.

For instance I used the following to install a Windows zip on Ubuntu (don't try this at home 🙂 !)

export CYPRESS_DOWNLOAD_PATH_TEMPLATE=https://download.cypress.io/desktop/12.17.3/win32-x64/cypress.zip
npm install cypress@12.17.3 -D -E --foreground-scripts

Windows is different. If you try to install macOS on Windows, then you do get an unzip error. Error: EPERM: operation not permitted, symlink '..\..\..\update-browserslist-db\cli.js'

chris-mo commented 1 year ago

i was actually able to remedy our situation by making sure we "yarn cache clear" before "yarn install" during our CI

thanks @MikeMcC399 for taking a look at all of this

nagash77 commented 1 year ago

I am going to close this issue as resolved at this point.