Skip to content

Instantly share code, notes, and snippets.

@gaearon
Created January 8, 2018 17:02
Show Gist options
  • Save gaearon/4064d3c23a77c74a3614c498a8bb1c5f to your computer and use it in GitHub Desktop.
Save gaearon/4064d3c23a77c74a3614c498a8bb1c5f to your computer and use it in GitHub Desktop.
Creating a new project with npm <= 5.2

If you use npm 5.1 or earlier, you can't use npx. Instead, install create-react-app globally:

npm install -g create-react-app

Now you can run:

create-react-app my-app
@thenafeeskausar
Copy link

Try this one if your npm is 6+
npm init react-app my-app
npm init is available in npm 6+
The problems listed above aren't all that serious. This is taking place as a result of an upgrade to the react version.

@jamessv
Copy link

jamessv commented Oct 18, 2023

Try this code

npm init react-app my-app or npm create-react-app my-app
cd my-app
npm start

@AminuAs7
Copy link

Gteat

@WisdomNnam
Copy link

not working with this command please guide me
npm install -g create-react-app
create-react-app my-app
Screenshot (41)

``

__

@jamessv
Copy link

jamessv commented Nov 5, 2023

Please use this code
npm create-react-app my-app
cd my-app
npm start

@Lashish
Copy link

Lashish commented Jan 7, 2024

For everybody who had or may have a problem with installation, here is one example of a solution https://stackoverflow.com/questions/70358474/error-while-creating-new-react-app-you-are-running-create-react-app-4-0-3-w

It works for me. Thanks😇

thanks

@25thOliver
Copy link

errr please help

@ArnoldFlexy
Copy link

Hi

The error in the image is related to an issue with Node.js's OpenSSL module, specifically regarding digital envelope routines:unsupported. This often occurs when the version of OpenSSL bundled with Node.js is incompatible with certain modules or cryptographic functions being used by the project.

Here are a few steps to resolve this issue:

  1. Upgrade react-scripts: Sometimes, older versions of react-scripts can cause compatibility issues. Try updating react-scripts to the latest version:

npm install react-scripts@latest

  1. Downgrade Node.js Version: If you're using Node.js version 20.x, it may not be compatible with some older packages. Try downgrading Node.js to an LTS version (such as 18.x or 16.x):

nvm install 18
nvm use 18

  1. Set OpenSSL Legacy Provider: Newer versions of Node.js have stricter defaults for OpenSSL. You can force Node.js to use legacy OpenSSL providers by setting the following environment variable:

export NODE_OPTIONS=--openssl-legacy-provider

Alternatively, you can add it directly to your package.json start script:

"scripts": {
"start": "react-scripts start --openssl-legacy-provider"
}

  1. Reinstall Node Modules: After making any of the above changes, it's a good idea to delete the node_modules folder and package-lock.json file and then reinstall the dependencies:

rm -rf node_modules package-lock.json
npm install

Try one or more of these solutions to resolve the issue.

@25thOliver
Copy link

25thOliver commented Oct 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment