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
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:
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:
If you are using Expo, the current official React Native docs recommend starting with a framework, typically:
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:
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:
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:
Or, if the project defines scripts:
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 foundoften means you should usenpxinstead of a global CLI command.' - Check
node,npm, andnpxbefore assuming the React Native tooling itself is broken. - Use
npx @react-native-community/cli init MyAppor the framework-based setup current docs recommend. - Inside a project, prefer
npx react-native ...or package scripts over global commands. - If
npxis missing, fix the Node installation or shellPATHfirst.
Related reading
- react-native command not found
- 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 Native android build failed. SDK location not found
- React Native iOS and Android folders not present
- React-router URLs don't work when refreshing or writing manually
- React - Display loading screen while DOM is rendering?
.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.