1
votes

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

4
did you installed create react app globally ? - Learner
@DILEEPTHOMAS yes I did! - Petra Jakubcova
which system are you using ? - Learner

4 Answers

0
votes

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.

0
votes

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

0
votes

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>
0
votes

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.