Cypress 在 MacOS 上启动失败

Cypress failed to start on MacOS

当我尝试使用 cypress opencypress run 时,出现以下错误:

 ✖  Verifying Cypress can run /*/*/.cache/Cypress/3.1.5/Cypress
   → Cypress Version: 3.1.5
Cypress failed to start.

This is usually caused by a missing library or dependency.

The error below should indicate which dependency is missing.

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.
----------

Command failed: /*/*/.cache/Cypress/3.1.5/Cypress/Cypress --smoke-test --ping=984
----------

Platform: darwin (17.6.0)
Cypress Version: 3.1.5

错误中没有列出依赖项,我没有使用 docker。我应该尝试什么?

对我有用的一件事是取消设置 NODE_OPTIONS 环境变量:

MacOS

unset NODE_OPTIONS
cypress open

在 Windows

set NODE_OPTIONS=
cypress open

如果失败,请按照 user on Github 的建议尝试以下操作:

在 MacOS 上:

  • 清除/Users/[username]/Library/Caches/Cypress
  • 运行 npm i cypress -g
  • 运行 cypress open
  • 关闭终端
  • return 回到您的 node.js 项目和 运行 测试

在 Windows 上:

  • 清楚C:\Users[username]\AppData\Local\Cypress\Cache)
  • 以管理员身份启动命令提示符
  • 运行 npm i cypress -g
  • 运行 cypress open
  • 关闭命令提示符
  • return 回到您的 node.js 项目和 运行 测试

如果您是第一次使用 Cypress,请尝试 ./node_modules/.bin/cypress install