react-native
troubleshooting
command not found
setup errors
development tools

react-native command not found

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

react-native: command not found usually means the shell cannot find a React Native CLI binary. In modern React Native setups, that is often because developers expect a global react-native command even though the recommended workflow is to run the CLI through npx instead.

First Check Your Node Tooling

Before touching React Native itself, confirm that Node, npm, and npx are available:

bash
node -v
npm -v
npx --version

If one of these fails, React Native commands will fail too because the CLI depends on the Node toolchain.

Prefer npx Over a Global CLI

The current React Native workflow does not require a globally installed react-native binary. Instead, run the CLI with npx:

bash
npx react-native@latest init AwesomeApp

Inside an existing project, use:

bash
npx react-native start
npx react-native run-android

So if you type react-native run-android and the shell says "command not found," that does not automatically mean the project is broken. It may simply mean you are using an older command style.

Why the Old Global CLI Causes Trouble

Many older tutorials used a global package such as react-native-cli. That often created version mismatches between:

  • the globally installed CLI
  • the local project version
  • the current React Native template and tooling

If you still have the old global CLI installed, it can be worth removing it:

bash
npm uninstall -g react-native-cli

Then use npx so the project runs the CLI version it actually expects.

PATH Problems Still Happen

If npx works but a different global Node tool does not, your shell may not include the npm global binary directory in PATH. That is a general Node environment issue, not a React Native-specific one.

A quick check:

bash
npm config get prefix

If you intentionally use global npm binaries, make sure the corresponding bin directory is on your shell PATH. But for React Native specifically, using npx is usually the cleaner answer.

Existing Project Versus New Project

The command depends on what you are trying to do:

  • create a new app: npx react-native@latest init AppName
  • start Metro in an existing app: npx react-native start
  • run Android from an existing app: npx react-native run-android

That distinction matters because some people try to run a project command before they are even inside a React Native project directory.

Verify the Local Project Still Has React Native Installed

Inside an existing app, make sure the project still declares React Native as a dependency and that packages are installed:

bash
cat package.json
npm install

If node_modules is missing or the dependency tree is incomplete, npx react-native start may fail for a different reason after you solve the shell error. Fixing the command name only helps when the project dependencies are also present.

In other words, there are two separate checks:

  • can the shell find the CLI entry point
  • does the current project have the packages that CLI expects

Common Pitfalls

  • Expecting a global react-native command when modern setups use npx.
  • Following an old tutorial that still depends on the deprecated global CLI workflow.
  • Trying to run project commands outside the project directory.
  • Fixing React Native while the real problem is that Node or npx is not installed correctly.
  • Keeping an outdated global CLI that conflicts with the local project toolchain.

Summary

  • 'react-native: command not found usually means the shell cannot find a global CLI binary.'
  • In modern React Native setups, use npx react-native ... instead of relying on a global command.
  • Check Node, npm, and npx before changing anything else.
  • Remove the old global CLI if it is causing version confusion.
  • Treat the error as a tooling-path issue first, not as a React Native application bug.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.