Skip to content

快速上手

环境准备

首先得有 node,并确保 node 版本是 18 或以上

包管理器

推荐使用 pnpm

创建项目

bash
pnpm dlx create-umi@latest
 Install the following package: create-umi? (Y/n) · true
 Pick Npm Client pnpm
 Pick Npm Registry taobao
Write: .gitignore
Write: .npmrc
Write: .umirc.ts
Copy:  layouts/index.tsx
Write: package.json
Copy:  pages/index.tsx
Copy:  pages/users.tsx
Copy:  pages/users/foo.tsx
@ postinstall /private/tmp/sorrycc-vylwuW
umi setup
info  - generate files

启动项目

  • 执行命令
bash
pnpm dev
        ╔═════════════════════════════════════════════════════╗
 App listening at:
  >   Local: https://127.0.0.1:8000
ready -  > Network: https://192.168.1.1:8000

 Now you can open browser with the above addresses👆
        ╚═════════════════════════════════════════════════════╝
event - compiled successfully in 1121 ms (388 modules)
event - MFSU compiled successfully in 1308 ms (875 modules)
  • 在浏览器打开http://localhost:8000/ 就能看下如下画面