4

i have installed CRA for over a month and have been working with it without having any problems, however today i created a new react app and it builds the folders and directories except it doesn't generate src and public folder(it just generated node-modules folder) thus when i run npm start it gives me an error saying:

npm ERR! missing script: start

enter image description here

enter image description here

Ebdulmomen1
  • 606
  • 1
  • 10
  • 21

5 Answers5

4

Initially you might have installed create-react-app globally.Try to remove using npm uninstall -g create-react-app command and then try npx create-react-app <your-app-name>. The reason is, npx should use it's latest version to work. Hope your doubt is now cleared

Nisheanthan
  • 151
  • 1
  • 1
  • 10
  • this solution works for the above problem. do you face the similar problem where the folder gets built but doesn't generate `src` . if so try checking your “build” script in package.json . – Nisheanthan Jan 24 '20 at 15:10
  • No It geenearets but src and public folder are missing – user123456 Jan 24 '20 at 18:14
2

I still have no idea what was the reason but I got it working doing these:

-uninstalled create-react-appusing npm uninstall -g create-react-app.

-using npx create-react-app app-name I created a new app and now it's working as expected.

Community
  • 1
  • 1
Ebdulmomen1
  • 606
  • 1
  • 10
  • 21
1

I have tried installing in different computers and for most cases the above codes helped to fix the issue. But in a rare case I had to use another code and it worked perfectly. Try running the below code

 npx --ignore-existing create-react-app Your-AppName
Nikz
  • 1,346
  • 1
  • 18
  • 24
0

I tried all the suggestions stated above but none works for me.I just run these commands and create a new project.

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

This work for me.

Ali Akbar
  • 7
  • 5
-3

You can create project with yarn:

yarn create-react-app my-app
Alan4747
  • 1
  • 1