H. Tuğkan Kibar
Posted on May 26, 2021
Working behind a corporate VPN / proxy is a situation most of us (especially when working in large corporations) have to face day to day. If so, and if you are using a tool such as ZScaler, you might end up getting a dreaded "Error: unable to get local issuer certificate" error when trying to install Cypress for the first time.
Surely you could disable the VPN, and all would be well - mainly due to Cypress caching the version it downloads.
However - to fix this issue you could also go for the following route of including the binary into your repo (or a mirror of course).
To do so - here is what I've done;
- Download the binary from Cypress - most likely your CLI will already show the URL for the failed download step.
- (Skip this step if you will mirror Cypress) Create a folder for your binaries, I've went with making a binaries folder, at the project root and creating a cypress folder there which includes the downloaded file as version.zip, in this case "6.9.1.zip". (You can use a different folder / naming obviously).
- Create / edit the .npmrc file at the project root level.
-
Depending on your situation add one of the following lines;
- If you will include the binary in your own repo like I've noted:
CYPRESS_INSTALL_BINARY=../../binaries/cypress/6.9.1.zip
- If you will mirror the cypress and keep the same layout:
CYPRESS_DOWNLOAD_MIRROR=https://example.com/
- If you will include the binary in your own repo like I've noted:
Check if it works by running
yarn
ornpm install
. Remember - if it worked even once; you might have stuff still in cache. To make sure that is not the case, you can runrm -rf $(npx cypress cache path)
which will clear out your cache location.
Hope it helps - happy hacking!
Posted on May 26, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.