[Fixed] Fix for dependency issue with create-react-app? – Create-react-app

by
Liam Thompson
create-react-app node.js npm react-scripts reactjs

Quick Fix: To resolve the dependency issue with create-react-app, uninstall the existing version using npm uninstall -g create-react-app and then reinstall it by running npx create-react-app <AppName>.

The Problem:

A React novice faces a hurdle when initializing a project with npx create-react-app, resulting in a dependency issue. Despite several attempts, including installing, uninstalling, and clearing the cache, the error persists, leaving the project stuck with only the basic files (node_modules, package-lock.json, and package.json). The beginner seeks a definitive solution to resolve the dependency issue and successfully initiate the React project.

The Solutions:

Solution 1: Uninstall `Create-React-App` Globally

Uninstall create-react-app using this command:

npm uninstall -g create-react-app

Now try again to create your React app.

npx create-react-app <AppName>

Solution 2: Uninstall React Native CLI and Create New Project

Sometimes, the issue could be related to a conflict with the React Native CLI. Here are the steps you can try:

  1. Uninstall React Native CLI globally:
npm uninstall -g react-native-cli
  1. After uninstalling React Native CLI, create a new React project using the following command:
npx create-react-app app

This should create a new React project without any dependency issues. Remember that this solution is specific to cases where there is a conflict with React Native CLI. If you find yourself in such a scenario, following these steps can help resolve the issue and allow you to create a new React project successfully.

Q&A

What is the fix for the global installs of create-react-app which are no longer supported issue?

Uninstall create-react-app globally and try again

What is the fix for the issue with react-native-cli?

Uninstall react-native-cli and then create the project again.

What alternative command can be used to create a react project?

Use npx create-react-app instead of create-react-app

Video Explanation:

The following video, titled "One of your dependencies, babel-preset-react-app, is importing ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Fixing Babel Dependency Issue in create react app project Error in 5 Minutes | Babel preset react. Code With Suresh•1.3K views · 11:41 · Go to ...