`npx create-react-app` cannot be used directly when creating a React project
P粉704066087
P粉704066087 2023-08-09 13:03:49
0
1
520

When I create a React app, I should first run the command "npm install create-react-app" and then "npx create-react-app name", otherwise it will give an error, but others only need to run the second A command, why?

I tried downloading the latest version of Node.js, npm, and clearing the cache, but I still got an error when I tried to run it.

npx create-react-app name

Still need to run npm install create-react-app. Please help me solve this problem.

P粉704066087
P粉704066087

reply all (1)
P粉633075725

You should now no longer need to installcreate-react-appglobally. The recommended way to create new React applications is to usenpx

If you have previously installed create-react-app globally, it may conflict with the latest version. You can try to uninstall it:npm uninstall -g create-react-app

You can clear the cache using the following command:npm cache verify

Finally, you can create the app using the following command:npx create-react-app@latest my-app

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!