-
Notifications
You must be signed in to change notification settings - Fork 395
Description
Situation
If there is a download error using npm install
to install Cypress using the shell installation script for Cypress factory/installScripts/cypress/default.sh and the directory /root/.cache
is created, the script continues and does not pass the error to the caller. The exit code is then incorrect 0
(success):
child process exited with code 0
In the CircleCI config circle.yml, jobs which build and test images with Cypress included then fail when testing the image, instead of failing at the stage of image build. The image build reports success even if the npm install cypress
step failed when it was trying to download the Cypress binary.
Logs
See https://app.circleci.com/pipelines/github/cypress-io/cypress-docker-images/2652/workflows/5a18425e-95d7-4476-99d9-fd575260ef75/jobs/82724 for an example:
- job "building docker image" shows
#12 [included included_image 9/1] RUN node /opt/installScripts/cypress/install-cypress-version.js 14.5.3
#12 0.153 Installing Cypress version 14.5.3
#12 12.87 npm error code 1
#12 12.87 npm error path /usr/local/lib/node_modules/cypress
#12 12.87 npm error command failed
#12 12.87 npm error command sh -c node index.js --exec install
#12 12.87 npm error [STARTED] Task without title.
#12 12.87 npm error The Cypress App could not be downloaded.
#12 12.87 npm error
#12 12.87 npm error 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
#12 12.87 npm error
#12 12.87 npm error Otherwise, please check network connectivity and try again:
#12 12.87 npm error
#12 12.87 npm error ----------
#12 12.87 npm error
#12 12.87 npm error URL: https://download.cypress.io/desktop/14.5.3?platform=linux&arch=x64
#12 12.87 npm error Error: Corrupted download
#12 12.87 npm error
#12 12.87 npm error Expected downloaded file to have checksum: 57802c291754033bd352dbc9f4f916af46e72c556d9591647f104f041a1c1dabcbb37f5f81fe4b3409b664dabd44641b5aea50dcfbc246344549ba68c11066a1
#12 12.87 npm error Computed checksum: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
#12 12.87 npm error
#12 12.87 npm error Expected downloaded file to have size: 202953897
#12 12.87 npm error Computed size: 0
#12 12.87 npm error
#12 12.87 npm error ----------
#12 12.87 npm error
#12 12.87 npm error Platform: linux-x64 (Debian - 12.11)
#12 12.87 npm error Cypress Version: 14.5.3
#12 12.87 npm error [FAILED] The Cypress App could not be downloaded.
#12 12.87 npm error [FAILED]
#12 12.87 npm error [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
#12 12.87 npm error [FAILED]
#12 12.87 npm error [FAILED] Otherwise, please check network connectivity and try again:
#12 12.87 npm error [FAILED]
#12 12.87 npm error [FAILED] ----------
#12 12.87 npm error [FAILED]
#12 12.87 npm error [FAILED] URL: https://download.cypress.io/desktop/14.5.3?platform=linux&arch=x64
#12 12.87 npm error [FAILED] Error: Corrupted download
#12 12.87 npm error [FAILED]
#12 12.87 npm error [FAILED] Expected downloaded file to have checksum: 57802c291754033bd352dbc9f4f916af46e72c556d9591647f104f041a1c1dabcbb37f5f81fe4b3409b664dabd44641b5aea50dcfbc246344549ba68c11066a1
#12 12.87 npm error [FAILED] Computed checksum: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
#12 12.87 npm error [FAILED]
#12 12.87 npm error [FAILED] Expected downloaded file to have size: 202953897
#12 12.87 npm error [FAILED] Computed size: 0
#12 12.87 npm error [FAILED]
#12 12.87 npm error [FAILED] ----------
#12 12.87 npm error [FAILED]
#12 12.87 npm error [FAILED] Platform: linux-x64 (Debian - 12.11)
#12 12.87 npm error [FAILED] Cypress Version: 14.5.3
#12 12.87 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-07-25T15_23_47_180Z-debug-0.log
#12 12.90 child process exited with code 0
#12 DONE 13.0s
Suggestion
In the script factory/installScripts/cypress/default.sh, use set -e to ensure that a failure in npm install
is reflected in the process exit code.