lanlin / notes

个人笔记
https://github.com/lanlin/notes/issues
30 stars 0 forks source link

Failed to install Cypress? or 安装 Cypress 失败 #93

Open lanlin opened 4 years ago

lanlin commented 4 years ago

情景

Cypress 测试起来是很爽,但是安装依赖的时候就头痛了。 尤其是对于墙内用户来说,就算挂了科学工具,往往不是失败就是慢得出奇。

解决办法

1. 首先按操作系统下载 cypress 安装包到本地

// macos下载链接
https://download.cypress.io?platform=darwin

// linux下载链接
https://download.cypress.io?platform=linux

// windows下载链接
https://download.cypress.io?platform=win32&arch=x64

2. 执行安装命令, 注意修改一下路径,指向你下载的安装包

macOS 或者 Linux

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

参考文档

https://docs.cypress.io/guides/getting-started/installing-cypress.html#Download-URLs