101 lines
1.4 KiB
Markdown
101 lines
1.4 KiB
Markdown
# 快速开始指南
|
||
|
||
## 解决 wails.json 错误
|
||
|
||
如果遇到 "wails.json: The system cannot find the file specified" 错误,请按以下步骤操作:
|
||
|
||
### 步骤 1: 安装前端依赖
|
||
|
||
```powershell
|
||
cd frontend
|
||
npm install
|
||
```
|
||
|
||
### 步骤 2: 构建前端
|
||
|
||
```powershell
|
||
npm run build
|
||
```
|
||
|
||
这会生成 `assets` 目录和所有前端资源。
|
||
|
||
### 步骤 3: 运行应用
|
||
|
||
```powershell
|
||
cd ..
|
||
go run app.go
|
||
```
|
||
|
||
## 如果仍然遇到问题
|
||
|
||
### 检查文件是否存在
|
||
|
||
确保以下文件存在:
|
||
- `wails.json` ✓ (已创建)
|
||
- `assets/` 目录 ✓ (已创建)
|
||
- `assets/index.html` ✓ (已创建)
|
||
|
||
### 如果 assets 目录为空
|
||
|
||
需要先构建前端:
|
||
|
||
```powershell
|
||
cd frontend
|
||
npm install
|
||
npm run build
|
||
cd ..
|
||
```
|
||
|
||
### 验证 Go 模块
|
||
|
||
```powershell
|
||
go mod tidy
|
||
go mod download
|
||
```
|
||
|
||
### 检查 Wails3 版本
|
||
|
||
确保使用的是正确的 Wails3 版本。如果使用的是 Wails v2,配置方式可能不同。
|
||
|
||
## 开发模式
|
||
|
||
### 前端开发(热重载)
|
||
|
||
```powershell
|
||
cd frontend
|
||
npm run dev
|
||
```
|
||
|
||
### 后端开发
|
||
|
||
在另一个终端:
|
||
|
||
```powershell
|
||
go run app.go
|
||
```
|
||
|
||
## 常见错误解决
|
||
|
||
### 1. "module not found"
|
||
|
||
```powershell
|
||
go mod tidy
|
||
go mod download
|
||
```
|
||
|
||
### 2. "assets not found"
|
||
|
||
确保已构建前端:
|
||
```powershell
|
||
cd frontend
|
||
npm run build
|
||
```
|
||
|
||
### 3. "ffmpeg not found"
|
||
|
||
确保 FFmpeg 已安装并在 PATH 中:
|
||
```powershell
|
||
ffmpeg -version
|
||
```
|
||
|