cypress: npm postinstall fails behind an HTTPS proxy
Current behavior:
I’m running behind an HTTPS corporate proxy configured with a self-signed certificate. This requires to setup the self-signed certificate with NODE_EXTRA_CA_CERTS environment variable.
yarn install cypress gives the following error (same with npm)
> cypress@2.1.0 postinstall /app/oison-frontend/node_modules/cypress
> node index.js --exec install
Installing Cypress (version: 2.1.0)
✖ Downloading Cypress
→ Cypress Version: 2.1.0
Unzipping Cypress
Finishing Installation
The Cypress App could not be downloaded.
Please check network connectivity and try again:
----------
URL: https://download.cypress.io/desktop/2.1.0?platform=linux&arch=x64
Error: self signed certificate in certificate chain
----------
Platform: linux (Debian - 8.10)
Cypress Version: 2.1.0
It seems NODE_EXTRA_CA_CERTS is not honored by the post installation script downloading cypress binary.
Desired behavior:
It should work
How to reproduce:
Come to my company and have fun configuring this proxy sh*t.
Additional Info (images, stack traces, etc)
It was working yesterday, so I think something has changed in the package of 2.1.0 release.
- Operating System: Ubuntu
- Cypress Version: >=2.1
- Browser Version:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 22
- Comments: 31 (8 by maintainers)
I had this problem a few days ago and found that the best workaround was to download the zip file directly from the site then type the following command before attempting npm install. This should then install the file from your zip file. Hope that helps.
CYPRESS_BINARY_VERSION=/local/path/to/cypress.zipCypress should (at least) honor the following env vars, which is the de facto way of configuring proxy:
HTTP_PROXY/http_proxyHTTPS_PROXY/https_proxyAlso, because it’s node:
NODE_EXTRA_CA_CERTSAnd perhaps also the following npm configs:
cafilehttps-proxyproxyStuff like setting
NODE_TLS_REJECT_UNAUTHORIZED=0or similar is out of the question, and defeats the whole purpose of secure connections.so, if you have man in the middle corporate proxy, you can add the extra certificate as an environment variable.
It’s solved our problem.
example:
Try this environment variable:
From version 3.x.x you chould use
export CYPRESS_INSTALL_BINARY=/Users/bvd1n4r/Downloads/cypress.zip@uriannrima awesome! There is some workaround documentation on this exact thing in our Epic proxy issue here: https://github.com/cypress-io/cypress/issues/1469
For windows: SET CYPRESS_INSTALL_BINARY=/path/to/zipfile/cypress.zip npm install cypress
We’re working on patching up fixes to release this as fast as we can. The introduction of the proxy code brought up some regressions we needed to address before releasing.
@jennifer-shehane Any time frame when this fix might be release as this issue is stopping us from using cypress in our environments
This issue is blocking us from using Cypress - a fix would be super useful.
1. Download the binary manually here: https://download.cypress.io/desktop 2. npm install: CYPRESS_INSTALL_BINARY=/path/to/zipfile/cypress.zip npm install cypress --save-dev
For anyone that’s stuck waiting for the patch I have a solution for local testing that works for me.
C:\Users\oskar\AppData\Local\Cypress\Cache\3.2.0(Important; you have to have the same folder structure -->3.2.0\Cypress\{content of cypress install}package.jsonin your project to match Cypress version 3.2.0 --> runyarn install(npm install) in your projectyarn cypress runI have tried this setup on two different windows machine and it works on both.
Would be great to see this fixed
@brian-mann I was having the same issue of ECONNREFUSED for being behind corporate proxy, had already configured
PROXYandHTTP-PROXYon npm config list, but it still ocurred. ConfiguredHTTP_PROXYandHTTPS_PROXYon system environments and it finally downloaded successfully.(It was needed to use @vue/cli template)
@davidsteinsland Cypress should already support the
HTTP_PROXYandHTTPS_PROXYenv vars since it usesrequestunder the hood to download the binary…