---
sidebar_position: 1
---

Wails 有许多安装前需要的常见依赖项：

# 安装

## 支持的平台

- 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 下载页面](https://golang.org/dl/)下载 Go。

确保您遵守官方的[Go 安装说明](https://golang.org/doc/install#install)。 您还需要确保您的 `PATH` 环境变量包含您的 `~/go/bin` 目录路径。 重启终端并执行以下命令检查：

- 检查 Go 是否安装正确： `go version`
- 检查 "~/go/bin" 是否在您的 PATH 变量中： `echo $PATH | grep go/bin`

### NPM

从[Node 下载页面](https://nodejs.org/en/download/)下载 NPM。 最好使用最新版本，因为这是我们通常会测试的版本。

运行 `npm --version` 进行验证。

## 平台指定依赖关系

您还需要安装指定平台的依赖项：

<!-- @formatter:off -->

<Tabs
    defaultValue="Windows"
    values={[
        {label: "Windows", value: "Windows"},
 {label: "MacOS", value: "MacOS"},
 {label: "Linux", value: "Linux"},
 ]}
>
    <TabItem value="MacOS">
        Wails requires that the xcode command line tools are installed. This can be done by running: <br/>
        <code>xcode-select --install</code>
    </TabItem>
    <TabItem value="Windows">
        Wails requires that the <a
        href="https://developer.microsoft.com/en-us/microsoft-edge/webview2/">WebView2</a>{" "}
        runtime is installed. Some Windows installations will already have this installed. You can check using
        the{" "}
        <code>wails doctor</code> command (see below). Some Windows installations will already have this installed. You can check using
        the{" "}
        <code>wails doctor</code> command (see below).
    </TabItem>
    <TabItem value={"Linux"}>
        Linux required the standard <code>gcc</code> build tools
        plus <code>libgtk3</code> and <code>libwebkit</code>.
        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 <code>wails doctor</code> after
        installation
        to be shown how to install the dependencies.
        If your distro/package manager is not supported, please consult the {" "}
        <a href={"/docs/guides/linux-distro-support"}>Add Linux Distro</a> 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 <code>wails doctor</code> after
        installation
        to be shown how to install the dependencies.
        If your distro/package manager is not supported, please consult the {" "}
        <a href={"/docs/guides/linux-distro-support"}>Add Linux Distro</a> guide.
    </TabItem>
</Tabs>

<!-- @formatter:on -->

## 可选依赖

- [UPX](https://upx.github.io/) 用于压缩您的应用程序。

## 安装 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.