React学习(01- vite创建react项目)

251 阅读1分钟

一、创建项目(by vite)

当然要用现在最火的 vite创建一个项目 vite文档

vite 创建项目对node版本有要求

Vite requires Node.js version 18+ or 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.

我的node版本为v20.12.1

  1. 创建项目
//创建react 项目命令
yarn create vite react-learning --template react

OK,第一步无惊无险 创建项目成功

image.png

  1. 按照提示进入项目根目录cd react-learning
  2. 安装依赖yarn
  3. 运行项目yarn dev

项目启动成功 image.png

项目结构如下

image.png