React Native CLI Tools

raw JSON →
2.0.1 verified Thu Apr 23 auth: no javascript abandoned

The `react-native-cli` npm package, specifically version 2.0.1 (last updated in 2017), served as the legacy command-line interface for bootstrapping and managing React Native projects. It was designed for global installation, enabling users to create new applications with `react-native init`. However, this package has been superseded; modern React Native development strongly advocates for using `npx react-native` instead. This `npx` approach dynamically fetches and executes the project-local CLI tools (primarily `@react-native-community/cli` or the `react-native` package itself), which ensures compatibility with the specific React Native framework version used in a given project, mitigating issues associated with outdated global CLI installations. The version numbers like v0.85.x seen in recent changelogs refer to the core `react-native` framework package, not this `react-native-cli` wrapper, which has effectively been abandoned.

error Sinopia crashes with "Module version mismatch"
cause Incompatible Node.js version used for installing global packages like Sinopia.
fix
Uninstall and reinstall sinopia globally (npm uninstall -g sinopia && npm install -g sinopia). If after upgrading Node.js (e.g., to Node 4), you may also need to reinstall npm (npm uninstall -g npm && nvm install npm).
error command not found: react-native
cause The global `react-native-cli` package is not installed, or your PATH environment variable is not correctly configured to find globally installed npm executables.
fix
The recommended solution is to use npx react-native <command> directly (e.g., npx react-native init MyProject), which does not require a global installation of react-native-cli. If you absolutely need the global react-native command for legacy reasons, ensure npm install -g react-native-cli was run successfully and your shell's PATH includes npm's global bin directory.
deprecated The `react-native-cli` npm package (version 2.0.1, last released in 2017) is effectively abandoned and no longer the recommended way to interact with React Native CLI features. Global installation can lead to significant compatibility issues with newer React Native framework versions.
fix Always use `npx react-native <command>` (e.g., `npx react-native init MyProject`) to ensure you're using the project-local or latest available CLI tools, instead of relying on a globally installed `react-native-cli`.
gotcha The version numbers like `0.85.x` seen in recent release notes refer to the `react-native` *framework* package, not the `react-native-cli` npm package which remains at `2.0.1` and is outdated.
fix Understand that `react-native-cli` is a legacy wrapper, and its version does not directly reflect the `react-native` framework version it can interact with. Always check the `react-native` package version within your project.
gotcha When using local development tools like Sinopia with `react-native-cli`, 'Module version mismatch' errors can occur if Node.js versions change between package installations.
fix For Sinopia specifically, uninstall and reinstall (`npm uninstall -g sinopia && npm install -g sinopia`). For general `react-native-cli` usage, the best fix is to migrate to `npx react-native`.
npm install react-native-cli
yarn add react-native-cli
pnpm add react-native-cli

Shows how to create and run React Native projects using the recommended `npx` command, emphasizing the deprecation of the global `react-native-cli` npm package.

// Modern recommended approach using npx to create and manage React Native projects:
console.log("// Step 1: Create a new React Native project (recommended)");
console.log("$ npx react-native@latest init AwesomeProject");
console.log("// This command dynamically fetches the necessary CLI tools and template.");
console.log("// It does not require a global 'react-native-cli' installation.");
console.log("");
console.log("// Step 2: Navigate into your new project directory");
console.log("$ cd AwesomeProject");
console.log("");
console.log("// Step 3: Start the development server (Metro Bundler)");
console.log("$ npx react-native start");
console.log("");
console.log("// Step 4: Run the application on a target platform (e.g., iOS simulator)");
console.log("$ npx react-native run-ios");
console.log("");
console.log("// Legacy approach (not recommended due to package abandonment and potential compatibility issues):");
console.log("// $ npm install -g react-native-cli@2.0.1");
console.log("// $ react-native init DeprecatedProject");
console.log("// This legacy package can cause compatibility issues with newer React Native versions.");