--- title: Debugging tools description: Learn about different tools available to debug your Expo project. sidebar_title: Tools --- import ImageSpotlight from '~/components/plugins/ImageSpotlight'; import { Terminal } from '~/ui/components/Snippet'; import Video from '~/components/plugins/Video'; import { Collapsible } from '~/ui/components/Collapsible'; React Native consists of both JavaScript and native code. Making this distinction is very important when it comes to debugging. If an error is thrown from the JavaScript code, you might not find it using debugging tools for native code. This page lists a few tools to help you debug your Expo project. ## Debugging with Chrome DevTools As with websites, you can use Chrome DevTools to gain insights into the JavaScript code of your app. With this tool, you can access the [Console](#interacting-with-the-console), [Source](#pausing-on-breakpoints), and [Network](#inspecting-network-requests) tab when using [dev clients](/more/glossary-of-terms/#dev-clients). You can use the Chrome DevTools on any app using Hermes. To open it, start your app and press j in the terminal where Expo was started. Once you have opened the Chrome DevTools, it will appear as below: ### Pausing on breakpoints You can pause your app on specific parts of your code. To do this, set the breakpoint under the Sources tab by clicking the line number, or add the `debugger` statement in your code. Once your app is executing code that has a breakpoint, it will entirely pause your app. This allows you to inspect all variables and functions in that scope. You can also execute code in the [Console](#interacting-with-the-console) tab as part of your app. > **warning** Breakpoints set through the Chrome DevTools depend heavily on source maps. Unfortunately, these source maps are not always 100% accurate. In some cases, you might have to use a `debugger` statement instead of a breakpoint. ### Pausing on exceptions If your app throws unexpected errors, it can be hard to find the source of the error. You can use Chrome DevTools to pause your app and inspect the stack trace and variables the moment it throws an error. > **info** Some errors might be caught by other components in your app, such as Expo Router. In these cases, you can turn on **Pause on caught exceptions**. It will enable you to inspect any thrown error, even when handled properly. ### Interacting with the console The Console tab gives you access to an interactive terminal, connected directly to your app. You can write any JavaScript inside this terminal to execute snippets of code as if it was part of your app. The code is executed in the global scope by default. But, when using breakpoints from the [Source](#pausing-on-breakpoints) tab, it executes in the scope of the reached breakpoint. This allows you to invoke methods and access variables throughout your app. ### Inspecting network requests The **Network tab** gives you insights into the network requests made by your app. You can inspect each request and response by clicking on them. This includes `fetch` requests, external loaded media, and in some cases, even requests made by native modules. > **warning** This feature is only available from Expo SDK 49 and higher. > **info** See the [Inspecting network traffic](#inspecting-network-traffic) for alternative ways to inspect network requests. ## Debugging with VS Code > **warning** This feature is only available from Expo SDK 49 and higher. VS Code is a popular code editor, which has a built-in debugger. This debugger uses the same system as the Chrome DevTools — the inspector protocol. You can use this debugger with the [Expo Tools](https://github.com/expo/vscode-expo#readme) VS Code extension. This debugger allows you to set breakpoints, inspect variables, and execute code through the debug console. To start debugging: - Connect your app - Open VS Code command palette (based on your computer, it's either Ctrl + Shift + p or Cmd ⌘ + Shift + p) - Run the **Expo: Debug ...** VS Code command. This will attach VS Code to your running app. ## Debugging with React DevTools React DevTools is a great way to look at your components' props and state. You can open it by pressing Shift + m in the terminal where Expo was started. Once it's open, it will appear as below: React DevTools can also be paired with the [element inspector](#showhide-element-inspector), allowing you to inspect props, state, and instance properties by tapping components inside your app. ## Developer menu This menu gives you access to several functions which are useful for debugging and is built into the Expo Go or dev client apps. If you are using the emulator, simulator, or have your device connected via USB, you can open this menu by pressing m in the terminal where Expo was started. - Android device (without USB): Shake the device vertically. - Android Emulator or device (with USB): - Press Cmd ⌘ + m or Ctrl + m - Run `adb shell input keyevent 82` - iOS device (without USB): - Shake the device. - Touch 3 fingers to the screen. - iOS Simulator or device (with USB): - Press Ctrl + Cmd ⌘ + z or Cmd ⌘ + d Once you have opened the Developer menu, it will appear as below: The Developer menu provides multiple options: - Reload: reloads your app. Usually not necessary since Fast Refresh is enabled by default - Copy Link: copy the [`exp://`](/guides/linking/#linking-to-expo-go) link of your app. - Go Home: leave your app and navigate back to the Expo Go app's Home screen - Enable/Disable Fast Refresh: toggle automatic refreshing of the JS bundle whenever you make changes to files in your project using a text editor Now let's explore some of the more exciting functionalities. ### Debug Remote JS > **warning** Debug remote JS does not support apps using Hermes, see the [Chrome DevTools](#debugging-with-chrome-devtools) section. Opens a React Native Debugger tab in your browser to allow you to use DevTools. For example, you can use the Console tab to read the `console.log` statements. It uses [`@react-native-community/cli-debugger-ui`](https://github.com/react-native-community/cli/tree/main/packages/cli-debugger-ui): > **warning** The Network tab will not work out of the box. To enable the Network tab and other debugging tools, additional setup is required, see the [React Native Debugger](#react-native-debugger) and section below. ### Show Performance Monitor Opens up a small window giving you performance information about your app. It provides: - RAM usage of your project - JavaScript heap (this is an easy way to know of any memory leaks in your application) - 2 numbers for Views, the top indicates the number of views for the screen, the bottom indicates the number of views in the component - Frames Per Second for the UI and JS threads. The UI thread is used for native Android or iOS UI rendering. The JS thread is where most of your logic runs, including API calls, touch events, and so on. ### Show/Hide Element Inspector Opens up the Element Inspector overlay: This overlay has capabilities to: 1. Inspect: Inspect elements 2. Perf: Show Performance overlay 3. Network: Show network details 4. Touchables: Highlight touchable elements ## React Native Debugger > **warning** The React Native Debugger does not support apps using Hermes, see the [Chrome DevTools](#debugging-with-chrome-devtools) section. The React Native Debugger includes many tools listed later on this page, all bundled into one, including [React DevTools](#debugging-with-react-devtools) and network request inspection. For this reason, if you use one tool from this page, it should probably be this one. We'll give a quick look at it here, but check out their [documentation](https://github.com/jhen0409/react-native-debugger#documentation) for a more in-depth look. You can install it via the [release page](https://github.com/jhen0409/react-native-debugger/releases), or if you're on macOS you can run: ### Startup After firing up React Native Debugger, you'll need to specify the port (shortcuts: Cmd ⌘ + t on macOS, Ctrl + t on Linux/Windows) to `8081` (for SDK 48 and lower, the port is `19000`). After that, run your project with `npx expo start`, and select `Debug remote JS` from the Developer Menu. The debugger should automatically connect. In the debugger console, you can see the Element tree, as well as the props, state, and children of whatever element you select. You also have the Chrome console on the right, and if you type `$r` in the console, you will see the breakdown of your selected element. If you right-click anywhere in the React Native Debugger, you'll get some handy short-cuts to reload your JS, enable/disable the element inspector, network inspector, and to log and clear your `AsyncStorage` content.