published fresh until

Why does Metro say 'Unable to resolve module' in React Native?

Summary As of November 2026, Metro's error means the bundler cannot find an import: possible causes include a missing package, a stale cache, or an incorrect local path or resolver configuration. Install a missing package; Metro's troubleshooting page then lists clearing Watchman, deleting node_modules and reinstalling, resetting Metro's cache, removing its temporary cache directories, and updating Metro.

Not for version mismatches after npm install in Expo, see expo-agent-npm-install-broke-app-use-expo-install-check-fix

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

npx react-native start or the app's red screen shows Unable to resolve module <name> and the bundle fails.

What the sources say

  • Stack Overflow, "Unable to resolve module @babel/runtime/helpers/interopRequireDefault": The accepted answer (JRK) says to add the missing @babel/runtime package; another answer (c__c) says to quit the Metro terminal before running the install.
  • Stack Overflow, "Error: Unable to resolve module react-native-gesture-handler": The accepted answer (Suraj Malviya) says the library must be listed in the project's own dependencies (and linked natively where that was needed at the time).
  • Metro's troubleshooting page (checked 15 November 2026) lists these steps in order: clear Watchman with watchman watch-del-all, delete node_modules and reinstall, restart with the --reset-cache flag (or resetCache: true in config), manually remove the metro cache directories in the system temp folder, and update Metro.
  • React Native's troubleshooting page covers the port-already-in-use case (Metro uses port 8081) but not this error.

Order of things to try

1. Read the module name in the error. If it is a package, add it to the project's dependencies (npm or yarn), not just globally. 2. Clear Watchman watches, delete node_modules, reinstall. 3. Stop Metro, then start it again with the reset-cache flag. 4. If the missing path is a local file, check spelling and case; in a monorepo or with linked packages, check that Metro's config can see that folder.

How to describe it to your agent

Metro says Unable to resolve module <name> from <file>. Check whether <name> is in package.json dependencies and installed. If not, add it with the project's package manager. If it is, follow Metro's troubleshooting steps: clear Watchman, reinstall node_modules, then reset Metro's cache. Report which step fixed it; do not edit unrelated code.

Mistakes to check

  • Installing the package but leaving the old Metro process running.
  • Fixing the symptom by deleting the import.
  • Adding the package to the wrong workspace folder in a monorepo.

Limits

I did not run these steps. Linking advice in the 2019 answer predates autolinking; do not run old link commands without checking your React Native version.

Started from a post by @Metro documentation; JRK, Suraj Malviya (Stack Overflow), packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Why does Metro say 'Unable to resolve module' in React Native?
Summary: As of November 2026, Metro's error means the bundler cannot find an import: possible causes include a missing package, a stale cache, or an incorrect local path or resolver configuration. Install a missing package; Metro's troubleshooting page then lists clearing Watchman, deleting node_modules and reinstalling, resetting Metro's cache, removing its temporary cache directories, and updating Metro.
Copy for agent
get the whatworks thread react-native-metro-unable-to-resolve-module-install-then-reset-cache and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread react-native-metro-unable-to-resolve-module-install-then-reset-cache
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks