This feature is only supported in the Ultimate edition.
IntelliJ IDEA provides a built-in debugger for your client-side JavaScript code that works with Chrome. The video and the instructions below walk you through the basic steps to get started with this debugger.
Before you start, configure the built-in debugger as described in Configuring JavaScript Debugger.
To use the Live Edit functionality
that shows the changes in your HTML and CSS in the browser on the fly,
install the JetBrains IDE Support
Chrome extension. Find more about that in Live Editing of HTML, CSS, and JavaScript.
Debugging an application running on the built-in server
IntelliJ IDEA has a built-in web server that can be used to preview and debug your application.
This server is always running and does not require any manual configuration.
All the project files are served on the built-in server with the root URL http://localhost:<built-in server port>/<project root>,
with respect to the project structure.
To start debugging:
- Set the breakpoints in the JavaScript code, as required.
- Open the HTML file that references the JavaScript to debug or select the HTML file in the Project view.
- On the context menu of the editor or the selection, choose Debug <HTML_file_name>.
IntelliJ IDEA generates a debug configuration and starts a debugging session through it.
The file opens in the browser, and the Debug tool window appears.
To save the automatically generated configuration for further re-use, choose Save <HTML_file_name> on the context menu after the debugging session is over.
- In the Debug tool window, proceed as usual: step through the program, stop and resume the program execution, examine it when suspended, view actual HTML DOM, etc.
Example
Suppose you have a simple application that consists of an index.html file and a MyJavaScript.js file,
where index.html references MyJavaScript.js.
To start debugging this application using the built-in server, open index.html in the editor
and choose on the context menu:


in the upper right-hand corner of the IntelliJ IDEA window
or choose on the main menu:

Debugging an application running on an external web server
Often you may want to debug client-side JavaScript running on an external development web server, e.g. powered by Node.js.
To start debugging
- Set the breakpoints in the JavaScript code, as required.
-
Run the application in the development mode. Often you need to run
npm startfor that. When the development server is ready, copy the URL address at which the application is running in the browser - you will need to specify this URL address in the run/debug configuration. -
Create a debug configuration of the type JavaScript Debug:
Choose on the main menu, click the Add New Configuration button
on the toolbar,
and select JavaScript Debug from the pop-up list.
-
In the Run/Debug Configuration: JavaScript Debug dialog box that opens, specify the URL address at which the application is running.
This URL can be copied from the address bar of your browser as described in Step 2 above. Click OK to save the configuration settings. -
Choose the newly created configuration in the Select run/debug configuration drop-down list on the toolbar
and click the Debug toolbar button
. The URL address specified in the run configuration opens in the browser
and the Debug tool window appears.
- In the Debug tool window, proceed as usual: step through the program, stop and resume the program execution, examine it when suspended, view actual HTML DOM, etc.
See Debugging React Applications
and Debugging Angular Applications
for examples.
Starting a debugging session with your default Chrome profile
You may notice that your debugging session starts in a new window with a custom profile instead of your default one.
As a result, the window looks unusual, for example, your bookmarks, the browser history, and the extensions are missing, which altogether breaks your development experience.
That happens because IntelliJ IDEA uses Chrome Debugging Protocol
and runs Chrome with the --remote-debugging-port option. However, if Chrome is already started,
a debugging port can't be opened for any new or existing Chrome instance that has the same profile.
To ensure consistent user experience, IntelliJ IDEA always starts a debugging session in a new window with a custom Chrome profile.
To avoid this problem, configure Chrome in IntelliJ IDEA to start with your profile or debug with the JetBrains Chrome extension as you did before.
To configure Chrome in IntelliJ IDEA with your profile
- Save your Chrome profile anywhere on your machine.
- In the Settings/Preferences dialog (Ctrl+Alt+S), choose Web Browsers under Tools. The Web Browsers page opens.
-
To create a new Chrome configuration, click
.
A new item appears in the list. In the Path field, specify the path to the Chrome installation folder.
-
Select the new configuration and click
.
The Chrome Settings dialog opens.
- Select the Use custom profile directory checkbox and specify the path to your Chrome profile in the IntelliJ IDEA settings.
-
Mark your Chrome browser configuration default
as described in Choosing the default IntelliJ IDEA browser,
and don't forget to choose Default from the Browser list
when creating a run/debug configuration.
Alternatively, always choose this Chrome browser configuration from the Browser list.
To debug with the JetBrains Chrome extension
Install the extension and configure the Live Edit functionality
as described in Live Editing of HTML, CSS, and JavaScript.
Debugging asynchronous code
IntelliJ IDEA supports debugging asynchronous client-side JavaScript code.
IntelliJ IDEA recognizes breakpoints inside asynchronous code, stops at them, and lets you step into such code.
As soon as a breakpoint inside an asynchronous function is hit or you step into asynchronous code, a new element Async call from <caller>
is added in the Frames pane of the Debugger tab.
IntelliJ IDEA displays a full call stack, including the caller and the entire way to the beginning of the asynchronous actions.
The image below shows an example of a JavaScript debugging session.

function), then will move to line6.
The asynchronous debugging mode is turned on by default.
To disable asynchronous stack traces, set js.debugger.async.call.stack.depth in Registry to 0.
Debugging workers
IntelliJ IDEA supports debugging Service Workers
and
Web Workers
.
IntelliJ IDEA recognizes breakpoints in each worker and shows the debug data for it
as a separate thread in the Frame pane on the
Debugger tab of the Debug Tool Window.
Note that IntelliJ IDEA can debug only
dedicated workers
,
debugging for shared workers
is currently not supported.
- Set the breakpoints in the Workers to debug.
-
If you are using Service Workers, make sure the Allow unsigned requests checkbox
on the Debugger page is selected. Otherwise your service workers may be unavailable
during a debug session:

- Create a debug configuration of the type JavaScript Debug as described above in Debugging client-side JavaScript running on an external web server.
-
Choose the newly created configuration in the Select run/debug configuration drop-down list on the tool bar
and click the Debug toolbar button
.
The HTML file specified in the run configuration opens in the chosen browser and the Debug Tool Window opens with the Frames drop-down list showing all the Workers:

To examine the data (variables, watches, etc.) for a Worker, select its thread in the list and view its data in the Variables and Watches panes. When you select another Worker, the contents of the panes are updated accordingly.