Debug opens the wrong browser
I have PhpStorm 2017.1.4 running on Ubuntu 16.04.4 LTS 64-bit.
Running FireFox debug uses the Google Chrome debugger no mater what I do. In particular, I can't get it to run in Firefox. I go to "Run | Debug ..." and click on "Edit Configurations ...". The browser dropdown shows "Debug" with a Firefox logo. I click on the "..." button to the right of that. I try all three options for the "Default Browser "item.
1. "System default" presumably should point to Firefox since that is how I've configured that in the OS to be my default browser.
2. "First listed" points to Firefox as I confirm in the path box to the right.
3. "Custom path" points to Firefox. Copy and paste form the path box to a terminal window calls Firefox.
In all cases, trying to debug calls Google Chrome. Trying to Run ("Run | Run ..." uses Firefox.
I've gotten Chrome set up to be usable as debugging browser. However, I personally prefer Firefox (so sue me). Besides, there is always the possibility of running into non-Chrome browser-specific bugs. I need to be able to use something other than chrome for that.
Ideas? Thanks in advance.
请先登录再写评论。
Hi there,
What language/code are you trying to debug -- PHP or JavaScript?
Better show a screenshots of your Run/Debug config used etc -- the way how Debug can be invoked from context menu can be quite confusing -- you have to pay attention to the icon .. ro you may end up creating the configuration for wring language etc.
JavaScript debug is basically Chrome-only .. unless you will use Firefox Remote debug.
In general (may be a bit out of date as for the latest version though): https://confluence.jetbrains.com/display/PhpStorm/JavaScript+Debugging+in+PhpStorm
In my case on macOS, when I tried to debug javascript, IDEA kept opening VMware Fusion to try to run Chrome in Windows.
Turns out that my /Applications/Google Chrome.app was not native but instead was put there by VMware, and my native Chrome was somewhere else.
The VMware version contains this
/Applications/Google\ Chrome\ VMware.app/Contents/MacOS/vmware-docker
instead of the usual stuff that launches a native app.
My problem went away after I moved the VMwarized app to "Google Chrome in VMware.app" and moved the native one to /Applications/Google Chrome.app
It would be nice if the IDEA config UI would cover this situation.
IDEA is picking up OS defaults.
Not sure if it's worth implementing a detection mechanism that would check if the path is in any way related to VMware.app.
Hello!
This has been the same behaviour for me, for a couple of PHPStorm versions as well.
OS default is firefox, I have firefox as first choice in the list as well, plus I unchecked Chrome in the list of browsers.
My "Run javascript" action will still open up chrome.
PhpStorm 2021.1.2
Build #PS-211.7142.44, built on April 30, 2021
@Lorant Bene
That is correct behaviour: JavaScript debug is basically Chrome-based (see the first link for some details).
For Firefox you have to manually create and use Firefox Remote type of Run/Debug Configuration:
Don't know if anyone is still reading this, but for me it's the opposite:
My sys default browser is Firefox (Ubuntu 20.10) but I want to debug in Chrome.
I can't get webstorm to start the chrome browser. No matter what I do it starts firefox.
Any idea?
Cheers,
Felix
@Felix
Show your settings. What type of Run/Debug Configuration do you use? What button/icons do you click to do the debug etc etc. Anything that would help understanding what you are doing.
Andriy Bazanov
Yes, sorry. Not really useful information.
(I am not even sure if I understand the debug feature correctly - sorry, stupid backend engineer ;-)
Then I click on the green debug button, as I would do in any Java / C / Go whatever application.
Firefox opens.
I expect remote debugging as for example with Java Remote Debugging.
By the way: When I click on this link in the log output. It respects the preference and opens chrome (but without debugging mode)
So you are trying to debug the npm script, right?
1. I'm not really a JavaScript person (rather basic JS + some jQuery and alike) .. but I strongly believe this is a wrong way of debugging your app. I believe this is for debugging an actual npm script itself (using your Node.js and not the browser).
https://www.jetbrains.com/help/webstorm/installing-and-removing-external-software-using-node-package-manager.html#ws_npm_running_npm_scripts
2. As stated on your 2nd screenshot (the execution of that task) ... it is actually "npm start" that does launch the OS default browser (look at the "Starting the development server..." and the next line).
Correct. Because it just normally opens the URL in your preferred browser. That's it.
Please check this section of the Help, perhaps it will help you: https://www.jetbrains.com/help/webstorm/debugging-javascript-in-chrome.html
Andriy Bazanov
Yes, got it. It tries to debug the npm script itself. Makes sense to me.
Alright. I am debugging in Firefox and Chrome directly in the DevConsole and the Browser's react plugins right now.
I'll read again how to set this up correctly.
Anyway, thanks so far for your time!
Cheers
Sorry for resurrecting but my problem is all to similiar. I have a vue app which I want to debug. I followed the doc on how to debug and ctrl + shift + clicked the localhost:8080 url. PHPstorm creates a debug configuration and starts my default ubuntu browser, which is Opera. But it starts a totally different browser session. It is not using my running Opera or at least uses the same browser instance I would get from calling "opera" in the terminal.
For example if I run opera from the terminal, I get a browser in dark mode and my configured devtools. If PHPStorm opens opera, it is in light mode, en-US locale and all settings are gone.
Can I tell PHPStorm to use the running browser or at least having it to create a new instance with my default settings?
>Can I tell PHPStorm to use the running browser
no; the IDE needs to pass
--remote-debugging-port
option to Opera (or the other Chrome-based browser used for debugging) in order to attach a debugger; there is no way to pass this option to a running instance, so attaching to opened browser is not possible.>or at least having it to create a new instance with my default settings?
Opera is started with new fresh profile to ensure that no instances using the same user data are running so that the debug flag can be passed. You can set up Opera to run with your user data, but, if you do this, you need to make sure that no instances that use this data are open when you start the debugger
Thank you. I will look into it. Is the fresh profile always fresh? Would it make sense to configure the browser with that profile?
No, it's not always fresh. It is normally created in the IDE system folder (like `~\AppData\Local\JetBrains\PhpStorm2022.3\chrome-user-data-xxxx` ) and re-used on next debugger invocations
I copied my default profile folder into the one phstorm created and cleared all browser data. Worked with it for four hours now and everything seems to be working fine. Thank you for your help.