Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress can't find Chrome after update to 3.3.0 #4260

Closed
jameseg opened this issue May 20, 2019 · 20 comments
Closed

Cypress can't find Chrome after update to 3.3.0 #4260

jameseg opened this issue May 20, 2019 · 20 comments

Comments

@jameseg
Copy link

jameseg commented May 20, 2019

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

@flotwig
Copy link
Contributor

flotwig commented May 20, 2019

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

@jameseg
Copy link
Author

jameseg commented May 20, 2019

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

@flotwig
Copy link
Contributor

flotwig commented May 20, 2019

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.

@jennifer-shehane jennifer-shehane added the type: regression A bug that didn't appear until a specific Cy version release label May 21, 2019
@jennifer-shehane
Copy link
Member

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

@jennifer-shehane jennifer-shehane added stage: needs information Not enough info to reproduce the issue browser: chrome and removed type: regression A bug that didn't appear until a specific Cy version release labels May 21, 2019
@jameseg
Copy link
Author

jameseg commented May 21, 2019

image

@jennifer-shehane
image

@jameseg
Copy link
Author

jameseg commented May 21, 2019

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

@petermouton
Copy link

petermouton commented May 22, 2019

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.

@petermouton
Copy link

Error remains in 3.3.1

@PetMou
Copy link

PetMou commented Jun 6, 2019

Moved to #4410

Details

Cypress 3.3.1

Cypress_Chrome_error

@flotwig
Copy link
Contributor

flotwig commented Jun 7, 2019

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.

@flotwig flotwig self-assigned this Jun 7, 2019
@jameseg
Copy link
Author

jameseg commented Jun 17, 2019

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?

@flotwig
Copy link
Contributor

flotwig commented Jun 17, 2019

@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...?

@jameseg
Copy link
Author

jameseg commented Jul 2, 2019

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

maybe a little more concise for my specific issue:
image

@jameseg
Copy link
Author

jameseg commented Jul 2, 2019

Running with the path...
image

@jameseg
Copy link
Author

jameseg commented Jul 2, 2019

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

@flotwig
Copy link
Contributor

flotwig commented Jul 2, 2019

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

@jameseg
Copy link
Author

jameseg commented Jul 2, 2019

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

@flotwig
Copy link
Contributor

flotwig commented Jul 2, 2019

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!

@colinbr96
Copy link

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

Warning to all: I ran this command and it deleted everything else in my PATH. Now I have to rewrite it from scratch.

@naraphim
Copy link

naraphim commented Aug 28, 2023

Aug 2023 - I installed Cypress and it wouldn't show Chrome as a selectable browser.
If I ran
wmic datafile where name="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" get Version /value
it wouldn't find any version.
It turns out I had actually installed Chrome in
"C:\Program Files\Google\Chrome\Application\chrome.exe"

I solved this issue based on #2834

I created a Directory Junction using mklink
mklink /J "C:\Program Files (x86)\Google\Chrome\Application" "C:\Program Files\Google\Chrome\Application"

Now when I run
wmic datafile where name="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" get Version /value
it indicates the current version
Version=116.0.5845.111

Now when I run Cypress it shows the Chrome Browser.
Chrome in Cypress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants