我之前安装了 Cypress 7.2.0,现在需要升级到 13.6.6。
我使用
cypress cache clear
卸载了所有缓存的 Cypress 安装,并使用 安装了 cypress 13.6.6
npm install -g [email protected]
使用
cypress cache list
,我可以验证只安装了一个 cypress 版本,13.6.6。
但是当我运行
cypress open
时,我收到以下错误消息:
No version of Cypress is installed in: /Users/xxxx/Library/Caches/Cypress/7.2.0/Cypress.app
Please reinstall Cypress by running: cypress install
----------
Cypress executable not found at: /Users/xxxx/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/MacOS/Cypress
我尝试先运行
export CYPRESS_INSTALL_BINARY=<path_to_cypress_binary>
,然后运行cypress open
和CYPRESS_RUN_BINARY=/Users/xxxx/Library/Caches/Cypress/13.6.6/Cypress cypress open
,但都不起作用。
我使用的是 MacOS。如有任何帮助,我们将不胜感激。
-g
选项通常不与 Cypress 一起使用。您将安装到每个项目,并将 Cypress 二进制文件部分安装到 /Users/xxxx/Library/Caches/Cypress
,部分安装到项目 node_modules
。
使用
-g
选项,您现在在节点全局中拥有一个可能会干扰您的项目安装的版本。
检查
npm root -g
找到节点全局文件夹的路径,检查Cypress并删除(所有版本)
从项目中删除
node_modules
更新
package.json
至所需的 Cypress 版本
运行
npm install
恢复 node_modules