# Run and debug React applications

## Run a React application

> **Note:**
> Only for applications created with `create-react-app`.

Procedure:

1. Сlick ![the Run icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.run.svg) in the gutter next to the `start` script in `package.json`, or execute the `npm run start` command in the Terminal `Alt+F12` (Windows), `⌥ F12` (macOS), `⌥ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ T` (macOS System Shortcuts), `Alt+F12` (XWin), `Alt+F12` (GNOME), `Alt+F12` (KDE), `Alt+F12` (Emacs), `Alt+F12` (Sublime Text), `⌥ F12` (Sublime Text (macOS)), `Alt+F12` (NetBeans), `Ctrl+Alt+1` (Visual Studio), `⌘ ⌃ 1` (Visual Studio (macOS)), `Alt+F12` (Eclipse), `⌥ F12` (Eclipse (macOS)), or double-click the `start` task in the [npm tool window](npm-tool-window.html) (`View | Tool Windows | npm`).

![Run a React app in the development mode from package.json](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_react_run_dev_mode_package_json.animated.gif)

2. Wait till the application is compiled and the development server is ready.

The Run tool window or the Terminal shows the URL at which your application is running. If your application was generated with create-react-app, the default URL is `http://localhost:3000/`.  Click this link to view the application.

![React app is running](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_react_debug_cra_app_is_running.png)

> **Tip:**
> Thanks to the [Webpack Hot
> Module Replacement](https://webpack.github.io/docs/hot-module-replacement.html), when the development server is running, your application is automatically reloaded as soon as you change any of the source files and save the updates.

### Run a React application via a run/debug configuration

For applications created with `create-vite` in the IntelliJ IDEA New Project wizard [as described above](react.html#creating_react_app_with_generators), IntelliJ IDEA generates an [npm](run-debug-configuration-npm.html) configuration  with the default name npm start. This configuration runs the `react-scripts start` command that launches the development server and starts your application in the development mode.

In other cases, you need to [create a
run/debug configuration](#react_running_and_debugging_run_via_rc_create_rc) with the actual settings, such as, host, port, etc., manually.

#### Create an npm run/debug configuration

Procedure:

1. Go to `Run | Edit Configurations`. Alternatively, select Edit Configurations from the Run widget on the toolbar.

![Open the Edit Configurations dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_run_config_create.png)

In the Edit Configurations dialog that opens,

click the Add button (![the Add button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg)) on the toolbar and select npm from the list.

2. In the Configuration tab of the Run/Debug Configurations: npm dialog that opens, specify the location of the `package.json`, the Node.js runtime, and the package manager to use.

In the Command field, select run from the list and then select the script to run from the Scripts list. Most likely it will be the default `start` script but you can configure another one in your `package.json`, for example, to run the application on a custom port.

![npm run/debug configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_debug_npm_rc.png)

3. Optionally:

To open the application in the browser, update the configuration as follows: in the Browser / Live Edit tab, select the After launch checkbox, select the browser to open the application in, and specify the URL address at which the application wil run.

If you are going to debug the application, select [Google Chrome](http://www.google.com/chrome/) or another [Chromium-based browser](https://www.chromium.org/).

![Browser / Live Edit tab: select browser](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_run_rc_browser_tab_select_browser.png)

#### Run an application

Procedure:

1. Select the npm start run configuration from the list on the toolbar and click ![Run](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.execute.svg) next to it.

![Run a React app in the development mode via a run/debug configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_run_dev_mode.png)

2. Wait till the application is compiled and the development server is ready.

The Run tool window or the Terminal shows the URL at which your application is running. Click this link to view the application.

![React app is running](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_react_debug_cra_app_is_running.png)

Alternatively, enable IntelliJ IDEA to open the application on start [as
described above](#ws_react_start_app_in_dev_mode_enable_opening_browser).

> **Note:**
> When the development server is running, your application is automatically reloaded as soon as you change any of the source files and save the updates.

## Debug a React application

> **Note:**
> Debugging of React applications is only supported in [Google Chrome](http://www.google.com/chrome/) and in other [Chromium-based browsers](https://www.chromium.org/).

You can start a debugging session either by [launching a
run/debug configuration](#react_debug_with_rc) or [from the Run tool
window](#react_debug_from_tw) that shows the URL at which your application is running in the development mode.

### Start debugging via a run/debug configuration

To debug your React application, you need two run/debug configurations:

* An npm configuration to start your application in the development mode, [as described above](#react_running_and_debugging_run).

* A JavaScript Debug configuration to attach the debugger to the application that is running in the development mode.

You can create a JavaScript Debug configuration within the npm configuration to launch them at once, as described in [Run and debug a
React application with an npm run/debug configuration](#react_debug_two_rc).

Alternatively, create and launch an npm and a JavaScript Debug run/debug configurations separately, as described in [Start debugging with a JavaScript Debug run/debug configuration](#react_debug_via_js_debug_rc).

#### Run and debug a React application with a single npm run/debug configuration

Procedure: Run and debug a React application with a single npm run/debug configuration

1. Set the [breakpoints](using-breakpoints.html) in your code.

2. Create an npm configuration [as described above](#react_running_and_debugging_run_via_rc_create_rc).

If you generated your application with `create-react-app`, IntelliJ IDEA has already created an npm configuration with the default name npm start. The configuration is available from the Run widget and in the Run/Debug Configurations dialog.

![Autogenerated npm run/debug configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_run_dev_mode.png)

3. In the Configuration tab of the Run/Debug Configurations: npm dialog that opens, specify the location of the `package.json`, the Node.js runtime, and the package manager to use.

In the Command field, select run from the list and then select the script to run from the Scripts list. Most likely it will be the default `start` script but you can configure another one in your `package.json`, for example, to run the application on a custom port.

![npm run/debug configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_debug_npm_rc.png)

4. In the Browser / Live Edit tab, select the After launch checkbox, select [Google Chrome](http://www.google.com/chrome/) or another [Chromium-based browser](https://www.chromium.org/) from the list, select the with JavaScript debugger checkbox, and then specify the URL at which your application will run.

![npm configuration, Browser tab](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_debug_npm_rc_browser_tab.png)

5. Click Run.

To re-run the configuration, select it from the list in the  Run widget and click ![Run](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.execute.svg) next to it.

IntelliJ IDEA runs the application in the development mode and at the same time launches a debugging session.

![Debugging session](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_debug_npm_rc_debugging_session.png)

6. When the first breakpoint is hit, switch to the [Debug tool window](debug-tool-window.html) and

proceed as usual: [step through the program](stepping-through-the-program.html),  [stop
and resume](starting-the-debugger-session.html#pause-resume)  program execution, [examine it when suspended](examining-suspended-program.html), explore the call stack and variables, set watches, evaluate variables, [view actual HTML DOM](viewing-actual-html-dom.html), and so on.

To ignore source maps and step through the actually executed code, press ![the Disable Source Maps toggle button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sourceMapDisable.png) on the toolbar of the Debug tool window.

#### Start debugging with a JavaScript Debug run/debug configuration

Procedure:

1. Set the [breakpoints](using-breakpoints.html) in your code.

2. Start the application in the development mode [as described above](#react_running_and_debugging_run) and wait till the application is compiled and the development server is ready.

The Run tool window or the Terminal shows the URL at which your application is running. Copy this URL to [specify it
later
in the JavaScript Debug
configuration](#react_debug_specify_URL).

![Application is running in the development mode](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_debug_app_running_in_dev_mode.png)

3. Create a JavaScript Debug configuration. To do that, go to `Run | Edit Configurations` in the main menu, click ![the Add icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg), and select Javascript Debug from the list.

4. In the Run/Debug Configurations: JavaScript Debug dialog that opens, specify the name of the configuration and the URL address at which the application is running in the development mode. You can copy this URL in the Run tool window or in the Terminal, [as described above](#react_debug_copy_URL).

![Create a JavaScript Debug configuration: specify the URL](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_debug_create_js_debug_rc.png)

5. Click Debug.

To re-run the configuration, select it from the list in the  Run widget and click ![Debug](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.debug.svg) next to it.

![Run a JavaScript Debug configuration from the Run widget](https://resources.jetbrains.com.cn/help/img/idea/2026.2/react_debug_rerun_js_debug_rc.png)

6. When the first breakpoint is hit, switch to the [Debug tool window](debug-tool-window.html) and   proceed as usual: [step through the program](stepping-through-the-program.html),  [stop
and resume](starting-the-debugger-session.html#pause-resume)  program execution, [examine it when suspended](examining-suspended-program.html), explore the call stack and variables, set watches, evaluate variables, [view actual HTML DOM](viewing-actual-html-dom.html), and so on.

To ignore source maps and step through the actually executed code, press ![the Disable Source Maps toggle button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sourceMapDisable.png) on the toolbar of the Debug tool window.

### Start debugging from the Run tool window or from the built-in Terminal

If your application is running in the development mode on `localhost`, in particular, if it was generated with `create-react-app`, you can launch a debugging session right from the Run tool window or from the built-in Terminal.

Procedure:

1. Set the [breakpoints](using-breakpoints.html) in your code.

2. Start the application in the development mode [as described above](#react_running_and_debugging_run) and wait till the application is compiled and the development server is ready.

3. The Run tool window or the Terminal shows the URL at which your application is running.   Hold `Ctrl+Shift` (Windows), `Ctrl+Shift` (macOS), `Ctrl+Shift` (IntelliJ IDEA Classic (macOS)), `Ctrl+Shift` (macOS System Shortcuts), `Ctrl+Shift` (XWin), `Ctrl+Shift` (GNOME), `Ctrl+Shift` (KDE), `Ctrl+Shift` (Emacs), `Ctrl+Shift` (Sublime Text), `Ctrl+Shift` (Sublime Text (macOS)), `Ctrl+Shift` (NetBeans), `Ctrl+Shift` (Visual Studio), `Ctrl+Shift` (Visual Studio (macOS)), `Ctrl+Shift` (Eclipse), `Ctrl+Shift` (Eclipse (macOS)) and click this URL link. IntelliJ IDEA starts a debugging session with an automatically generated  configuration of the type [JavaScript Debug](run-debug-configuration-javascript-debug.html).

![Start debugging a React app from the Run tool window](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_react_start_debugging_from_run_tool_window.animated.gif)

If you launched your application in the development mode from the [New Terminal](terminal-emulator.html), you can just click the Start debugging in browser button next to the link.

![New Terminal: the Start debugging in browser button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_react_start_debugging_from_new_terminal_start_debugging_button.png)

By default, the button is not shown. To have it displayed,   open the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), go to `Advanced Settings`, and select the Show 'Start Debugging in Browser' button for localhost links in the Terminal checkbox in the JavaScript and TypeScript area.

> **Note:**
> The button is not available from the New Terminal in the WSL.

When the first breakpoint is hit, switch to the [Debug tool window](debug-tool-window.html) and   proceed as usual: [step through the program](stepping-through-the-program.html),  [stop
and resume](starting-the-debugger-session.html#pause-resume)  program execution, [examine it when suspended](examining-suspended-program.html), explore the call stack and variables, set watches, evaluate variables, [view actual HTML DOM](viewing-actual-html-dom.html), and so on.

To ignore source maps and step through the actually executed code, press ![the Disable Source Maps toggle button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/sourceMapDisable.png) on the toolbar of the Debug tool window.

## Known limitations

When you open an application during a debugging session for the first time, it may happen that some of the breakpoints in the code executed on page load are not hit. The reason is that to stop on a breakpoint in the original source code, IntelliJ IDEA needs to get the source maps from the browser. However, the browser can pass these source maps only after the page has been fully loaded at least once. As a workaround, reload the page in the browser yourself.

