[英]How can I create a react app using react js?
我是后端新手,在创建 React 应用程序时遇到问题。
我已经多次重新开始并创建了一个全新的终端,我将它放在名为“client”的文件夹中。
当我输入 npx create-react-app./ 时,我收到此错误:
ritamiranda@Ritas-MacBook-Air new project % cd client
ritamiranda@Ritas-MacBook-Air client % npx create-react-app./
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/xxx/Desktop/new project/client/create-react-app./package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/ritamiranda/Desktop/new project/client/create-react-app./package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxx/.npm/_logs/2022-07-04T18_25_05_983Z-debug-0.log
ritamiranda@Ritas-MacBook-Air client % cd [client]
zsh: no matches found: [client]
ritamiranda@Ritas-MacBook-Air client % npm create react app
npm ERR! could not determine executable to run
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ritamiranda/.npm/_logs/2022-07-04T18_26_41_818Z-debug-0.log
ritamiranda@Ritas-MacBook-Air client %
请帮忙,谢谢!
创建一个反应项目
我相信您实际上缺少命名您的应用程序。
要创建项目,请导航到要存储项目的文件夹并从终端运行:
npx create-react-app my-app
代替my-app
确保选择您想要调用项目的任何名称。
您可以使用 Vite 创建项目。 它比相对传统的方式更快。 您可以在终端中运行以下代码。
npm create vite@latest myapp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.