问题
I am trying to create a new project using create-react-app
using the command given on the docs i.e npx create-react-app my-app
but it doesn't contain folders like public
src
and script
.
回答1:
Try with these steps :
npm rm -g create-react-app
npm install -g create-react-app
npx create-react-app my-app
Source
回答2:
For those who keep trying and still doesn't work, you might have the same problem as me.
Because the global installs of create-react-app are no longer supported you might have it installed on your machine, thus have the old version running whenever you try to npx create-react-app. There are 2 very easy steps: remove create-react-app, then run the npx command.
It will look like this:
- sudo npm rm -g create-react-app (sudo is needed on macs to grant you permission, it will ask for your password, type it in and hit enter)
- npx create-react-app my-app
Should solve your problem there
回答3:
It is not working for me on windows machine. It worked when I ran below commands from git bash:
npm install -g create-react-app
npx create-react-app my-app
回答4:
You can uninstall a globally installed package with this:
npm uninstall -g create-react-app
回答5:
The thing that worked for me is:
npm rm -g create-react-app
npm install -g create-react-app
npx create-react-app my-app
回答6:
Follow the following steps and that should solve your problem.
sudo npm rm -g create-react-app
(Do not skip sudo if you are a macOS user).npx create-react-app my-app
(npm 5.2+ and higher) ornpm init react-app my-app
oryarn create react-app my-app
(if you use yarn)
回答7:
I tried all the suggestion stated above but none works for me. This suggestion at 8097 works for me. Basically, I just run npx create-react-app@latest your-project-name
回答8:
Still didn't got to know the issue. But i tried :-
npm rm -g create-react-app
npm install -g create-react-app
npx create-react-app my-app
This also didn't worked for me. So I uninstalled node and installed it again. It worked for me
来源:https://stackoverflow.com/questions/59260031/public-src-and-scripts-folder-not-created-while-using-create-react-app