安装
支持的平台
- Windows 10/11 AMD64/ARM64
- MacOS 10.13+ AMD64
- MacOS 11.0+ ARM64
- Linux AMD64/ARM64
依赖
Wails 有许多安装前需要的常见依赖项:
- Go 1.17+
- NPM (Node 15+)
Go
从Go 下载页面下载 Go。
确保您遵守官方的Go 安装说明。 您还需要确保您的 PATH
环境变量包含您的 ~/go/bin
目录路径。 重启终端并执行以下命令检查:
- 检查 Go 是否安装正确:
go version
- 检查 "~/go/bin" 是否在您的 PATH 变量中:
echo $PATH | grep go/bin
NPM
从Node 下载页面下载 NPM。 最好使用最新版本,因为这是我们通常会测试的版本。
运行 npm --version
进行验证。
平台指定依赖关系
您还需要安装指定平台的依赖项:
- Windows
- MacOS
- Linux
Wails 需要安装 xcode 命令行工具。 This can be done by running:
xcode-select --install
Wails requires that the WebView2 runtime is installed. Some Windows installations will already have this installed. You can check using the
wails doctor
command (see below). Some Windows installations will already have this installed. You can check using the wails doctor
command (see below). Some Windows installations will already have this installed. You can check using the wails doctor
command (see below).Linux required the standard
gcc
build tools plus libgtk3
and libwebkit
. Rather than list a ton of commands for different distros, Wails can try to determine what the installation commands are for your specific distribution. Run wails doctor
after installation to be shown how to install the dependencies. If your distro/package manager is not supported, please consult the Add Linux Distro guide. Rather than list a ton of commands for different distros, Wails can try to determine what the installation commands are for your specific distribution. Run wails doctor
after installation to be shown how to install the dependencies. If your distro/package manager is not supported, please consult the Add Linux Distro guide. Rather than list a ton of commands for different distros, Wails can try to determine what the installation commands are for your specific distribution. Run wails doctor
after installation to be shown how to install the dependencies. If your distro/package manager is not supported, please consult the Add Linux Distro guide.可选依赖
- UPX 用于压缩您的应用程序。
安装 Wails
运行 go install github.com/wailsapp/wails/v2/cmd/wails@latest
安装 Wails CLI。
系统检查
运行 wails doctor
将检查您是否安装了正确的依赖项。 如果没有,它会就缺少的内容提供建议以帮助纠正问题。
The wails
command appears to be missing?
If your system is reporting that the wails
command is missing, make sure you have followed the Go installation guide correctly. Normally, it means that the go/bin
directory in your User's home directory is not in the PATH
environment variable. You will also normally need to close and reopen any open command prompts so that changes to the environment made by the installer are reflected at the command prompt.