Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
160 views
in Technique[技术] by (71.8m points)

node.js - 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 this 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 'node_modules' folder and 'package.json' 'yarn.lock' files.

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

I thought probably for 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...