我无法打开赛普拉斯

时间:2018-11-13 03:08:16

标签: node.js visual-studio cypress

  1. 我安装Node js和Visual Studio代码,创建一个文件夹并打开cmd
  2. 输入npm init
  3. 输入npm install cypress,然后等待完成
  4. 我打开Visual Studio代码并运行命令: “ ./node_modules/.bin/cypress打开” 但是什么也没发生。赛普拉斯无法打开。 我尝试使用其他方式进行使用: npm run cypress:open ,但它也没有打开。

我在Window 10,Node js 8.12,Visual Studio代码1.27.2版上运行 在其他赛普拉斯可以在终端中与Windows PowerShell正常工作的PC中,但在错误PC中,它只能与cmd一起运行。

6 个答案:

答案 0 :(得分:1)

Cypress Open Error-Windows 10中首次安装程序的解决方案

如果是第一次尝试,则需要重新启动。 执行命令。\ node_modules.bin \ cypress open


PS C:\ Users \ Ashwini Sambandan \ cypressautomation> node_modules.bin \ cypress打开 看来这是您第一次使用Cypress:3.8.3

√经过验证的赛普拉斯! C:\ Users \ Ashwini Sambandan \ AppData \ Local \ Cypress \ Cache \ 3.8.3 \ Cypress

打开Cypress ...


答案 1 :(得分:0)

在Windows路径中使用\代替/

.\node_modules\.bin\cypress open

为了通过此命令npm run cypress:open运行cypress,您需要将"cypress:open": "cypress open"添加到scripts文件中的package.json字段中:

{
  "scripts": {
    "cypress:open": "cypress open"
  }
}

答案 2 :(得分:0)

form(method='POST' action='/signUp') div.form-group label(for='firstName') First Name input#firstName.form-control(type='text', name='firstName', value=firstName, required) div.form-group label(for='secondName') Second Name input#secondName.form-control(type='text', name='secondName', value=secondName, required) div.form-group label(for='email') Email: input#email.form-control(type='email', name='email', value=email, required) div.form-group label(for='username') Username if error: input#username.form-control(type='text', name='username', placeholder=error) else: input#username.form-control(type='text', name='username', placeholder='e.g.: miauMiau23 (this is the name your friends will identify you with') div.form-group label(for='password') Password: input#passwordw.form-control(type='password' name='password') button.btn.btn-primary(type='submit') Submit 文件中添加以下行代码

package.json

并使用以下命令提示符运行cypress thro'编辑器命令提示符

{
  "scripts": {
    "test": "cypress open"
  }
}

答案 3 :(得分:0)

我希望您必须为此找到解决方案。但是没有可接受的答案,因此我要添加一个对我有用的答案。

第一次运行柏树时就会发生这种情况。

搜索cypress.jsonctrl + p,然后键入cypress.json

将其粘贴到其中。

{
  "chromeWebSecurity": false,
  "hosts": {
    "*.localhost": "127.0.0.1"
  }
}

然后尝试npm run cypress opennpx cypress open

答案 4 :(得分:0)

  1. 导航到您的项目路径
<块引用>

cd /your/project/path

  1. 使用 npm 安装 Cypress
<块引用>

npm install cypress --save-dev

  1. package.json 文件中在脚本中添加以下行
<块引用>

"scripts": {"cypress:open": "cypress open"}

  1. 在终端输入命令
<块引用>

npm run cypress:open

然后会打开一个带有示例测试的 cypress 窗口。

答案 5 :(得分:-2)

您不清楚在第4步中要做什么。您是否从VS代码终端运行Cypress命令?如果是这样,请确保您在正确的位置。然后运行您的赛普拉斯启动命令。应该可以。

如果您位于正确的位置但仍然无法正常工作,也可以尝试:

npx cypress open在我的环境中就像一个魅力,需要npm@5.2.0或更高版本。让我知道你的进步。

https://docs.cypress.io/guides/getting-started/installing-cypress.html#Opening-Cypress