Hthien
Hthien

Reputation: 61

I can't open Cypress

  1. I install node js and visual studio code , Create a folder and open cmd
  2. Input npm init
  3. Input npm install cypress and wait to complete
  4. I open Visual studio code and run command: " ./node_modules/.bin/cypress open " But nothing is happened. Cypress can't open. I tried with other way as use : npm run cypress:open but it's not open too.

I run on Window 10, node js 8.12, visual studio code ver 1.27.2 In other PC which cypress worked normally with Windows PowerShell in terminal but in error PC it only run with cmd.

Upvotes: 6

Views: 37384

Answers (6)

Aish Anu
Aish Anu

Reputation: 1612

  1. Navigate to your project path

cd /your/project/path

  1. Install Cypress using npm

npm install cypress --save-dev

  1. In package.json file add below line inside scripts

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

  1. In terminal enter command

npm run cypress:open

Then a cypress window opens with example tests.

Upvotes: 2

Debu Shinobi
Debu Shinobi

Reputation: 2572

I hope you must find a solution for this. But there is no accepted answer so I to add one that worked for me.

It happens when you run cypress for the very first time.

Search for cypress.json or ctrl + p then type cypress.json.

Paste this in it.

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

Then try npm run cypress open or npx cypress open

Upvotes: 2

ashwini sambandan
ashwini sambandan

Reputation: 21

Cypress Open Error- Solution for first time installer in Windows 10

A restart is required if you are trying to do it for the first time. Execute the command .\node_modules.bin\cypress open


PS C:\Users\Ashwini Sambandan\cypressautomation> node_modules.bin\cypress open It looks like this is your first time using Cypress: 3.8.3

√ Verified Cypress! C:\Users\Ashwini Sambandan\AppData\Local\Cypress\Cache\3.8.3\Cypress

Opening Cypress...


Upvotes: 2

Rahil Kumar
Rahil Kumar

Reputation: 428

Add below code of line in package.json file

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

and run cypress thro' editor command prompt using below command prompt

npm run test

Upvotes: 5

Radiopepper
Radiopepper

Reputation: 101

It's a bit unclear what you're trying to do in step 4. Do you run the Cypress command from VS code terminal? If so, make sure you're in the correct location. Then run your Cypress start command. It should work.

If you are in the correct location and still doesn't work, you can also try:

npx cypress open works like a charm in my environment and requires [email protected] or greater. Let me know your progress.

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

Upvotes: 1

Vadim Yangunaev
Vadim Yangunaev

Reputation: 1991

Use \ instead of / in path for Windows:

.\node_modules\.bin\cypress open

In order to run cypress by this comand npm run cypress:open you need to add "cypress:open": "cypress open" to the scripts field in your package.json file:

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

Upvotes: 17

Related Questions