简介
安装项目引导
npm install -g create-tauri-app
创建项目
npx create-tauri-app@latest
Need to install the following packages:
create-tauri-app@4.5.7
Ok to proceed? (y) y
✔ Project name · tauri-app
✔ Identifier · com.tauri-app.app
✔ Choose which language to use for your frontend · TypeScript / JavaScript - (pnpm, yarn, npm, deno, bun)
✔ Choose your package manager · npm
✔ Choose your UI template · Vue - (https://vuejs.org/)
✔ Choose your UI flavor · TypeScript
Template created! To get started run:
cd tauri-app
npm install
npm run tauri android init
For Desktop development, run:
npm run tauri dev
For Android development, run:
npm run tauri android dev
安装依赖
国内切换数据源,解决慢的问题:
npm config set registry https://npmmirror.com/
执行:
cd tauri-app
npm install
run dev
npm run tauri dev
日志:
> tauri-app@0.1.0 tauri
> tauri dev
Running BeforeDevCommand (`npm run dev`)
> tauri-app@0.1.0 dev
> vite
VITE v5.4.11 ready in 740 ms
➜ Local: http://localhost:1420/
Updating crates.io index
Info Watching C:\Users\Administrator\tauri-app\src-tauri for changes...
Fetch [=====> ] 0 comp...
访问,打开:http://localhost:1420/
… 感觉要下载很多东西的样子
打包
npm run tauri build
参考资料
https://v2.tauri.app/start/