【Cypress】No version of Cypress is installed

问题描述

在使用npm install cypress --save-dev安装Cypress后,不管是直接运行npx cypress open还是切到node_modules/.bin目录下运行cypress open,都会提示未安装cypress

 No version of Cypress is installed in: C:\Users\ChenH\AppData\Local\Cypress\Cache\10.9.0\Cypress 
 Please reinstall Cypress by running: cypress install

由于网络原因(公司局域网),无法按照提示运行cypress install


原因分析

npm run一样,npx cypress open也会到node_modules/.bin目录下找可执行文件(.cmd.ps1),去看了下.bin文件夹下果然没有cypress的可执行文件


解决方案

既然不能通过命令行下载,那就直接下载到本地
这里提供两种解决方案:

先从先从https://download.cypress.io/desktop.json下载对应版本的安装包,这里是v10.9.0

方法1:自行解压缩后,CV到C:\Users\ChenH\AppData\Local\Cypress\Cache\10.9.0\Cypress

方法2:命令行运行set CYPRESS_INSTALL_BINARY=d:\cypress.zip设置环境变量为该压缩包的路径,然后重新运行npm i cypress -D

然后再运行npx cypress open就可以打开Cypress

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值