Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

public, src,and scripts folder not created while using create-react-app

I am trying to create a new project using create-react-app using the command given on the docs i.e npx create-react-app my-app but it doesn't contain folders like public src and script.

like image 972
Ankit Sinha Avatar asked Dec 10 '19 04:12

Ankit Sinha


People also ask

Why SRC and public folder is not created while installing react?

Because the global installs of create-react-app are no longer supported you might have it installed on your machine, thus have the old version running whenever you try to npx create-react-app .

What is public folder in Create react app?

The public folder contains the HTML file so you can tweak it, for example, to set the page title. The <script> tag with the compiled code will be added to it automatically during the build process.

How do I fix command not found create react app?

Use npx to solve the error "create-react-app: command not found", e.g. npx create-react-app my-app or install the package globally by running npm install -g create-react-app to be able to use the command without the npx prefix. The fastest way to solve the error is to use the npx command.


2 Answers

Try with these steps :

  1. npm rm -g create-react-app
  2. npm install -g create-react-app
  3. npx create-react-app my-app

Source

like image 161
Osama Aftab Avatar answered Sep 18 '22 16:09

Osama Aftab


For those who keep trying and still doesn't work, you might have the same problem as me.

Because the global installs of create-react-app are no longer supported you might have it installed on your machine, thus have the old version running whenever you try to npx create-react-app. There are 2 very easy steps: remove create-react-app, then run the npx command.

It will look like this:

  1. sudo npm rm -g create-react-app (sudo is needed on macs to grant you permission, it will ask for your password, type it in and hit enter)
  2. npx create-react-app my-app

Should solve your problem there

like image 33
keep1hunnid Avatar answered Sep 18 '22 16:09

keep1hunnid