Reputation: 61
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
Reputation: 1612
cd /your/project/path
npm install cypress --save-dev
"scripts": {"cypress:open": "cypress open"}
npm run cypress:open
Then a cypress window opens with example tests.
Upvotes: 2
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
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
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
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
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