可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Help! I have no idea what is going on here, create react app is not working I have also tried reinstalling and yet to no avail, please help!
Npm version: 5.4.2
Node version: 8.70
Tried the npm install --save --save-exact --loglevel error react react-dom react-scripts
回答1:
Please try this:
npm cache clean --force
回答2:
In my case, "create-react-app" was not installed. to install run this command
npm install -g create-react-app
Once installation successful, try running
npx create-react-app hello-world
If this works for you. Great else comment what worked for you,
回答3:
It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production.
You’ll need to have Node >= 8.10 and npm >= 5.6 on your machine. To create a project, run:
npx create-react-app my-app
cd my-app
npm start
Note:
npx on the first line is not a typo — it’s a package runner tool that comes with npm 5.2+.
Create react app provides more information regarding this.
It may be the problem of cache also, so can also try:
npm cache clean --force
回答4:
Make sure you are not running any antivirus, stop/pause all antivirus or protection software.
You can also try
use create-react-app projectname --save
or create-react-app projectname --save-exact and start again
OR
as the error suggests, you should use a newer version of node. You are using 8.9.4, you should probably use 8.12.0 LTS.
回答5:
I had the same problem, and I solved it by:
1. update the npm version (npm install npm@latest -g)
2. clear the cache (npm cache clean --force)
3. create the react project (npx create-react-app todo)
(create-react-app was already installed)
回答6:
The problem on my machine was caused by yarn. I am windows 10 and after uninstalling yarn using npm uninstall -g yarn, my script run correctly. So
- Open terminal and type: npm uninstall -g yarn
- Once done, close terminal and open new one
- type create-react-app (app name) and this should create your app :)
Please note that the above steps assume that you already have node and react-cli installed on your machine.
回答7:
on Ubuntu 18.04
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
回答8:
What I did, is going to
C:\Users\mycomputerName\AppData\Roaming\npm\
I changed the name of this file
create-react-app.ps1
to
create-react-appOld.ps1
or you can delete it, then it worked fine
回答9:
Tried all the above methods but no luck:(
Step1 : Reinstalled Node js
Step2 : Check whether environment variables has been created. if not create one for nodejs,npm and composer
Step3: Also add "C:\Windows\System32" to the global PATH environment variable.
Step4: Then use "npx create-react-app my-app" to create react project
Step5: Run the commmand : cd my-app and npm start
Step6: It will work
回答10:
I also experienced the same problem and SOLVED IT.
This is what I did.
- Restart your machine(computer)
- Deactivate your anti-virus. I chose the "permanently" option
- Open the terminal and run the "create-react-app" command again, It will definitely do the trick.
- Activate your anti-virus
- And get working :-)