Cypress: Cypress can't find Chrome after update to 3.3.0

Created on 20 May 2019  路  18Comments  路  Source: cypress-io/cypress

Current behavior:

After upgrading to 3.3.0, Cypress is unable to use the existing Chrome installation it used prior. In addition, now even after uninstalling/reinstalling several times both Cypress and Chrome, I can't get Chrome to be available anymore.

image

When trying to clear the app data from the GUI:

{ Error: spawn cmd ENOENT
    at _errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/wait',
     'C:\\Users\\James\\AppData\\Roaming\\Cypress\\cy\\production' ] }
Error: spawn cmd ENOENT
    at _errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

DEBUG logs:
https://pastebin.com/u6kLMHZ0
^this is the piece that worries me, since the logs seem to indicate that Cypress found Chrome, but doesn't have it available for execution.

additional info:
https://stackoverflow.com/questions/56224598/how-do-i-get-cypress-to-detect-my-existing-chrome-browser-after-upgrade

Desired behavior:


Cypress is able to use the existing Chrome application for execution, and is available in the dropdown menu in the GUI

Steps to reproduce: (app code and test code)

Windows 10
Cypress 3.2.0
Chrome installed in the correct location

  1. Upgrade using npm i cypress --save-dev
  2. Open cypress
  3. Look for Chrome to be now missing in the dropdown

Versions


Cypress 3.2.0
Cypress 3.3.0
Windows 10
Chrome 74

windows chrome

Most helpful comment

Hmm, looks similar to #3891.

Cypress uses WMIC.exe to look up info about a potential browser. If it can't be launched, browser detection is broken.

It looks like WMIC.exe isn't in your PATH. If you do echo $env:PATH, do you see C:\Windows\System32\Wbem? If not, add it:

setx PATH "$env:PATH;C:\Windows\System32\Wbem"

...and then restart VS code to pick up the new system-wide PATH. Check that echo $env:PATH shows the Wbem directory at the end, and then re-launch Cypress. Browser detection should work.


Environment variables on Windows are weird, you can obtain debug logs by using the cross-env package:

npm i -g cross-env
cross-env DEBUG=cypress:* npx cypress open

All 18 comments

Thanks for the bug report. Does this work for you in 3.2.0?

I actually am blocked now. I can't get it to find Chrome at all. I will try with a fresh 3.2 install though tomorrow

Alright, cool.

Also, try running this command too in Command Prompt, Cypress runs this internally to find your browser:

wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value

It should output something like Version=74.x.x.x.

If it doesn't output that, then this looks a duplicate of #3645, and you should be able to fix it by resetting your WMIC store by following the instructions from #3645.

Some troubleshooting tips as well: https://on.cypress.io/debugging#Launching-browsers

image

@jennifer-shehane
image

UPDATE: After installing 3.2.0:

image

I'm also able to click "View App Data" without that crazy ENOENT error message above.
I'm going to use this version for now, thanks for the advice @flotwig

Moved to #4410


Details

Same here.
After installing 3.3.0 I get the Whoops' window ('This browser was not launched through Cypress'), trying to run Chrome 74.
The Cypress add-in is loaded in to Chrome. The add-in is shown as version 0.0.0
The tests run fine under Electron 61.

Back to Cypress 3.2.0 and Chrome 74 runs again without problems.

Error remains in 3.3.1

Moved to #4410


Details

Cypress 3.3.1

Cypress_Chrome_error

Hey @petermouton @PetMou, this looks like a different issue than the original post in this thread, so I've created a new issue to track this: #4410 Let's move discussion there.

UPDATE 6-14-19: Another dev on my team implemented some new Cypress tests around a Vue component. We have multiple projects in the same solution using different "cypress test projects". The Cypress instances for my project (there are 2) still can't find Chrome after updating even to 3.3.1. Chrome is available in his project but neither of mine. Is there a setting per project (like maybe cypress.json) that might be affecting this?

@jameseg Can you re-share your debug logs? The pastebin in the OP has expired.

There aren't any per-project settings for browsers. Cypress attempts to find your browser on each run.

Does it work if you manually specify the path to your browser? ex: cypress open --browser "C:\path\to\chrome.exe"

Also, how are you launching Cypress? ex. via command prompt, powershell, powershell inside of VS code...?

Here's the latest DEBUG logs:
https://pastebin.com/FtqnHf9p

maybe a little more concise for my specific issue:
image

Running with the path...
image

And to answer your question I'm running cypress in VS Code using powershell

Hmm, looks similar to #3891.

Cypress uses WMIC.exe to look up info about a potential browser. If it can't be launched, browser detection is broken.

It looks like WMIC.exe isn't in your PATH. If you do echo $env:PATH, do you see C:\Windows\System32\Wbem? If not, add it:

setx PATH "$env:PATH;C:\Windows\System32\Wbem"

...and then restart VS code to pick up the new system-wide PATH. Check that echo $env:PATH shows the Wbem directory at the end, and then re-launch Cypress. Browser detection should work.


Environment variables on Windows are weird, you can obtain debug logs by using the cross-env package:

npm i -g cross-env
cross-env DEBUG=cypress:* npx cypress open

Fixed it. Thanks!

I think you should see this though, it looks like it was in the PATH to begin with. It only added to the end of the path with my command...
image

Ok, great. #3672 is also open to change the way we do browser detection to not use WMIC for reasons like this. Glad it's working!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weskor picture weskor  路  3Comments

szabyg picture szabyg  路  3Comments

igorpavlov picture igorpavlov  路  3Comments

jennifer-shehane picture jennifer-shehane  路  3Comments

simonhaenisch picture simonhaenisch  路  3Comments