1

Even though everything used to work couple of weeks ago, now I can not successfully create new react app with its templates.

When I try to run npx create-react-app my-app command, it only creates the folder with package.json, pckage-lock.json and node_modules. The public folder is missing and also, when I try to run npm start, it gives me an error saying:

npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:

before it used to say happy hacking and the template page with react logo was displayed.

I tried to uninstall and install node again, clear cache but nothing helped. Any advice? Thank you so much!

My npm -v is 6.13.4 and node -v is v12.14.0

  • 1
    https://github.com/facebook/create-react-app/issues/8088 – amdev Dec 30 '19 at 15:50
  • did you installed create react app globally ? – Learner Dec 30 '19 at 15:52
  • @DILEEPTHOMAS yes I did! – Petra Jakubcova Dec 30 '19 at 15:59
  • which system are you using ? – Learner Dec 30 '19 at 16:00
  • Does this answer your question? [Missing Script when I run npm start to create React app](https://stackoverflow.com/questions/56148511/missing-script-when-i-run-npm-start-to-create-react-app) – n0noob Dec 30 '19 at 16:04
  • @DILEEPTHOMAS is there any way of uninstalling node and installing it again from scratch. I tried everything but I keep getting error: A template was not provided. This is likely because you're using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported. – Petra Jakubcova Dec 30 '19 at 16:29
  • @n0noob thank you. I followed it but when I run the create-react-app command it gives me the same error. A template was not provided. This is likely because you're using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported. – Petra Jakubcova Dec 30 '19 at 16:33
  • @PetraJakubcova which system are you using windows, ubuntu or mac ? – Learner Dec 31 '19 at 08:05

4 Answers4

0

If you have installed create-react-app globally. remove that globally from you system

Try these steps

  1. npm uninstall -g create-react-app

  2. npx create-react-app app_name cd app_name npm start

Note- npx comes with npm 5.2+ and higher, see instructions for older npm versions

Check this reactjs documentation.

akhtarvahid
  • 9,445
  • 2
  • 26
  • 29
  • Thank you. I uninstalled it and ran npx create-react-app but it gave me this error: + react-dom@16.12.0 + react-scripts@3.3.0 + react@16.12.0 added 1674 packages from 765 contributors and audited 906205 packages in 93.644s 32 packages are looking for funding run `npm fund` for details found 0 vulnerabilities A template was not provided. This is likely because you're using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported. – Petra Jakubcova Dec 30 '19 at 16:27
0

First, update the npm and node using following commands:

npm install -g npm
npm cache clean -f
npm install -g n
n stable

Remove globally installed create-react-app using:

npm uninstall -g create-react-app

Use npx for using create-react-app directly:

npx create-react-app <project-name>
n0noob
  • 889
  • 8
  • 23
  • BTW you should not install `create-react-app` globally. [This](https://github.com/facebook/create-react-app#quick-overview) page says that they recommend uninstalling to ensure `npx` is always using the latest version –  Jan 01 '20 at 15:23
  • 1
    Updated my answer. The main point that I want to emphasize here is that ```node``` and ```npm``` should updated. – n0noob Jan 01 '20 at 18:59
0

Faced the same issue and fixed it by following the below steps:

  1. Try to uninstall all existing global installation of create-react-app and check that they are removed properly by using the two commands below:

    • command for uninstalling: npm uninstall -g create-react-app

    • command for checking: which create-react-app

    • command for manual delete: rm -rf <path where create react app is located>

  2. Once all the versions are removed, use: npx create-react-app <name_of_the_app>

For more details refer here

RobC
  • 22,977
  • 20
  • 73
  • 80
nbsamurai
  • 346
  • 4
  • 13
0

I was having the same issue, and saw a lot of the same answers saying to uninstall create-react-app globally and reinstall using npx create-react-app my-app.

Downgrading my version of Node to 8.11.1 is what fixed it.

sudo npm install -g n
sudo n 8.11.1
node -v
> v8.11.1

After that I ran npx create-react-app my-app and it worked as expected.

J Calton
  • 28
  • 7