react-native command not found
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
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:
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:
Inside an existing project, use:
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:
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:
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:
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-nativecommand when modern setups usenpx. - 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 foundusually 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
- React-Native Error Failed to install CocoaPods dependencies for iOS project, which is required by this template
- React-native How to build for ios from windows
- react-router nginx ingress refresh causes white screen when path is not /
- React-router URLs don't work when refreshing or writing manually
- React Native android build failed. SDK location not found
- React Native iOS and Android folders not present
- React - Display loading screen while DOM is rendering?
- React - Fetch from external API function on button click
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack 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.