Registry / web-framework / create-react-app

create-react-app

JSON →
library5.1.0jsnpmunverified

Create React App (CRA) is an official command-line interface (CLI) tool for quickly setting up new single-page React applications with zero build configuration. It abstracts away the complex setup of tools like Webpack, Babel, ESLint, and Jest, providing a pre-configured development environment out of the box. The latest version is 5.1.0, though significant updates were last documented in 5.0.1 (April 2022). CRA includes major upgrades to underlying tooling like webpack 5, Jest 27, ESLint 8, and PostCSS 8, along with support for React 18's `createRoot` API and Fast Refresh. While once the primary tool for new React projects, it is now officially deprecated for new applications and in maintenance mode, receiving only critical bug fixes and updates to support newer React versions. It differentiates itself by offering a fully managed, opinionated build setup, aiming for simplicity and a consistent developer experience, making it historically ideal for learning React or starting new projects without extensive build tooling knowledge.

npm install create-react-app
INSTALL
IMPORT
SIG · CREATE-REACT-APP
C
create-react-app
web-frameworkjavascriptv5.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Demonstrates how to scaffold a new React application using `npx` and start its development server, including an example for TypeScript.

npx create-react-app my-new-app cd my-new-app npm start // To create a TypeScript project: npx create-react-app my-ts-app --template typescript cd my-ts-app npm start
create-react-app --version
Debug
Known issues
breakingCreate React App (CRA) is officially deprecated for new projects and is in maintenance mode. The React team now recommends using modern frameworks like Next.js, Remix, or build tools like Vite for new applications, which offer better performance and more features.
fix
For new projects, consider alternatives like Vite (for simple SPAs), Next.js (for SSR/SSG), or Remix. For existing projects, consider a migration, especially if new features or significant performance improvements are needed.
affects: >=5.0.0
breakingVersion 5.0.0 introduced significant dependency upgrades including webpack 5, Jest 27, ESLint 8, and PostCSS 8. This also dropped support for Node.js 10 and 12, requiring Node.js 14 or higher. Custom configurations or older tooling might break.
fix
Ensure Node.js is updated to version 14 or higher. For existing projects, update `react-scripts` to `5.0.0` or later and address any breaking changes in custom configurations or linting rules. Deleting `node_modules` and reinstalling dependencies (e.g., `npm install`) might be necessary.
affects: >=5.0.0
breakingCreate React App 5.0.1 introduced improvements for React 18 compatibility, including updating templates to use `createRoot` instead of `ReactDOM.render`. Projects upgrading to React 18 with older `react-scripts` versions will need to manually update their `index.js` file.
fix
Update `react-scripts` to version 5.0.1 or higher. Change `ReactDOM.render(<App />, document.getElementById('root'))` to `ReactDOM.createRoot(document.getElementById('root')).render(<App />)` in `src/index.js`.
affects: >=5.0.1
gotchaThe `eject` command is a one-way operation that permanently removes the managed build configuration, exposing all Webpack, Babel, ESLint, and other configuration files. Once ejected, you are responsible for maintaining and updating all build tooling yourself, and you cannot easily revert to the managed CRA setup.
fix
Avoid ejecting unless absolutely necessary. For most customization needs, `craco` or `react-app-rewired` can provide a less destructive alternative. If you must eject, ensure you have a clear understanding of the underlying build tools and a backup of your project.
affects: All versions
gotchaUsing an outdated Node.js version (below 14) with Create React App 5.x will lead to installation failures or runtime errors, as it explicitly dropped support for Node 10 and 12.
fix
Ensure your Node.js version is 14.0.0 or later. Use a Node Version Manager (like `nvm` or `nvm-windows`) to easily switch and manage Node.js versions.
affects: >=5.0.0
Errors
Common errors & fixes
`create-react-app` is not recognized as an internal or external command
`create-react-app` was not installed globally, or `npx` (the recommended method) is not available or working correctly.
fix
Ensure `npx` is available (comes with npm 5.2+). The recommended way to create a new app is `npx create-react-app my-app`. If you prefer a global install, run `npm install -g create-react-app` (though this is discouraged now).
Failed to compile. Module not found: Error: Can't resolve 'react'
This usually indicates a corrupted `node_modules` directory or an incompatibility between `react-scripts` and other project dependencies, often after an upgrade.
fix
Delete the `node_modules` directory and `package-lock.json` (or `yarn.lock`), then run `npm install` (or `yarn install`) to reinstall dependencies cleanly. Updating `react-scripts` to the latest compatible version is also advised.
You are running Node 12.x.x. Create React App requires Node 14 or higher.
The installed Node.js version on your system is older than the minimum requirement for Create React App 5.x.
fix
Upgrade your Node.js version to 14.0.0 or later. Use `nvm install 16` (or desired LTS) and `nvm use 16` to manage Node versions.
TypeError: (0 , _some_module.default) is not a function
Often encountered after upgrading `react-scripts` to v5.0.0, particularly due to changes in ESLint 8 or Babel configuration, leading to issues with default exports or module interoperability.
fix
Ensure all project dependencies, especially `react-scripts`, `eslint-config-react-app`, and related ESLint plugins, are updated to their latest compatible versions. Review custom ESLint configurations for breaking changes introduced in ESLint 8. Deleting `node_modules` and reinstalling can sometimes help.
Upgrade
Version history
5.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Resources
create-react-app — npm install create-react-app · libregistry