node.jsreactjsnpmcreate-react-appyarnpkg

Why there isn't any file and folder except 'node_modules' and 'package.json' anymore when creating a project with 'npx create-react-app' command?


I created a react project with the 'npx create-react-app my-app' command before, and the 'my-app' folder contains these files and folders:

my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── public
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
└── src
    ├── App.css
    ├── App.js
    ├── App.test.js
    ├── index.css
    ├── index.js
    ├── logo.svg
    └── serviceWorker.js
    └── setupTests.js

But now, when I create a react project with the same command, the 'my-app' folder contains only the 'node_modules' folder and the 'package.json' and 'yarn.lock' files.

my-app
├── node_modules
├── yarn.lock
└── package.json

I thought probably using an outdated version of create-react-app, then to fix this, I did the following steps:

  1. Removing the old version of CRA by running npm rm -g create-react-app
  2. Installing the new version globally by running npm install -g create-react-app

But my issue still existed. The last thing that came to my mind was upgrading node.js from v10 to v12.16.3, but nothing didn't change.


Solution

  • This problem occurred because there is global installs of create-react-app are no longer supported. For solving this problem, run these command respectively:

    npm uninstall -g create-react-app
    

    Then install create-react-app in this way

    npm install create-react-app
    

    Then create your react app

    npx create-react-app my-app