react-native
command not found
troubleshooting
error fix
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

The react-native: command not found error usually means one of two things: either you are following an outdated tutorial that expects a global CLI, or your Node toolchain is not available on the current shell PATH. In modern React Native workflows, the first fix is often to stop calling a global react-native binary and use npx instead.

Start with the Modern Command Style

Older guides often tell you to run:

bash
react-native init MyApp

That is the source of many "command not found" reports. The current pattern is to invoke tools through npx, which resolves the package without depending on a permanently installed global command:

bash
npx @react-native-community/cli init MyApp

If you are using Expo, the current official React Native docs recommend starting with a framework, typically:

bash
npx create-expo-app@latest

So before debugging your shell too deeply, verify that the command you are trying to run is still the one current tooling expects.

Check Node and npm First

If npx itself is missing, the problem is not React Native yet. Check the Node toolchain:

bash
node --version
npm --version
npx --version

If one of these commands fails, your Node installation is missing or your shell cannot see it. Reinstalling Node or fixing the PATH is the next step.

On macOS and Linux, developers often use a version manager such as nvm. In that case, make sure the shell session has actually loaded it before you expect node, npm, or npx to work.

Verify the Shell PATH

Sometimes Node is installed correctly, but the current terminal session is not loading the right startup file.

You can inspect the resolved binaries directly:

bash
1which node
2which npm
3which npx
4echo $PATH

If which npx returns nothing, the shell does not know where your Node installation lives. That often happens after installing Node in one shell and running commands in another, or after switching terminals without reloading the shell profile.

Project Commands vs Global Commands

Inside an existing React Native project, you often do not need a global binary at all. Use package scripts or npx:

bash
npx react-native run-android
npx react-native run-ios

Or, if the project defines scripts:

bash
npm run android
npm run ios

This is more reliable than depending on a globally installed react-native executable that may not match the project's local tooling version.

When Global Installs Cause Trouble

Global CLI installs can create version mismatches. One project may expect newer tooling while your global command points at an older package. That is why modern JavaScript tooling tends to prefer npx or package scripts over global command assumptions.

If you do have a global react-native binary from an old tutorial, it may actually be the thing causing confusion rather than the thing you need to restore.

Common Pitfalls

The most common mistake is following an outdated guide that assumes react-native should exist as a global command. In many current setups, it should not.

Another common issue is debugging React Native before confirming that node, npm, and npx are available. If those base tools are missing, no React Native command will work correctly.

It is also easy to open a new shell after installing Node and forget to reload the startup configuration that adds the Node binaries to PATH.

Summary

  • 'react-native: command not found often means you should use npx instead of a global CLI command.'
  • Check node, npm, and npx before assuming the React Native tooling itself is broken.
  • Use npx @react-native-community/cli init MyApp or the framework-based setup current docs recommend.
  • Inside a project, prefer npx react-native ... or package scripts over global commands.
  • If npx is missing, fix the Node installation or shell PATH first.

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.