export CYPRESS_INSTALL_BINARY=/path/to/your/cypress.zip && npm install // for npm
export CYPRESS_INSTALL_BINARY=/path/to/your/cypress.zip && cnpm install // for cnpm
export CYPRESS_INSTALL_BINARY=/path/to/your/cypress.zip && yarn install // for yarn
Windows
set CYPRESS_INSTALL_BINARY=/path/to/your/cypress.zip && npm install // for npm
set CYPRESS_INSTALL_BINARY=/path/to/your/cypress.zip && cnpm install // for cnpm
set CYPRESS_INSTALL_BINARY=/path/to/your/cypress.zip && yarn install // for yarn
情景
Cypress 测试起来是很爽,但是安装依赖的时候就头痛了。 尤其是对于墙内用户来说,就算挂了科学工具,往往不是失败就是慢得出奇。
解决办法
1. 首先按操作系统下载 cypress 安装包到本地
2. 执行安装命令, 注意修改一下路径,指向你下载的安装包
macOS 或者 Linux
Windows
参考文档
https://docs.cypress.io/guides/getting-started/installing-cypress.html#Download-URLs