本页内容

安装

Deno 可以在 macOS、Linux 和 Windows 上运行。Deno 是一个单一的二进制可执行文件。它没有外部依赖项。在 macOS 上,提供 M1 (arm64) 和 Intel (x64) 可执行文件。在 Linux 和 Windows 上,仅支持 x64。

下载和安装 跳转到标题

deno_install 提供方便的脚本用于下载和安装二进制文件。

使用 Shell

curl -fsSL https://deno.land/install.sh | sh

使用 Homebrew

brew install deno

使用 MacPorts

sudo port install deno

使用 Nix

nix-shell -p deno

使用 asdf

asdf plugin-add deno https://github.com/asdf-community/asdf-deno.git

# Download and install the latest version of Deno
asdf install deno latest

# To set as the default version of Deno globally
asdf global deno latest

# To set as the default version of Deno locally (current project only)
asdf local deno latest

使用 vfox

vfox add deno

# Download and install the latest version of Deno
vfox install deno@latest

# To set the version of Deno globally
vfox use --global deno

使用 PowerShell (Windows)

irm https://deno.land/install.ps1 | iex

使用 Scoop

scoop install deno

使用 Chocolatey

choco install deno

使用 Winget

winget install deno

使用 vfox

vfox add deno

# Download and install the latest version of Deno
vfox install deno@latest

# To set the version of Deno globally
vfox use --global deno

使用 Shell

curl -fsSL https://deno.land/install.sh | sh

使用 Nix

nix-shell -p deno

使用 asdf

asdf plugin-add deno https://github.com/asdf-community/asdf-deno.git

# Download and install the latest version of Deno
asdf install deno latest

# To set as the default version of Deno globally
asdf global deno latest

# To set as the default version of Deno locally (current project only)
asdf local deno latest

使用 vfox

vfox add deno

# Download and install the latest version of Deno
vfox install deno@latest

# To set the version of Deno globally
vfox use --global deno

您也可以使用 Cargo 从源代码构建和安装。

cargo install deno --locked

Deno 二进制文件也可以手动安装,方法是下载 github.com/denoland/deno/releases 上的 zip 文件。这些包只包含一个可执行文件。您需要在 macOS 和 Linux 上设置可执行位。

Docker 跳转到标题

有关官方 Docker 镜像的更多信息和说明,请访问:https://github.com/denoland/deno_docker

测试您的安装 跳转到标题

要测试您的安装,请运行 deno --version。如果这将 Deno 版本打印到控制台,则安装成功。

使用 deno help 查看记录 Deno 标志和用法的帮助文本。获取有关 CLI 的详细指南,请访问 这里

更新 跳转到标题

要更新先前安装的 Deno 版本,您可以运行

deno upgrade

或使用 Winget (Windows)

winget upgrade deno

这将从 github.com/denoland/deno/releases 获取最新版本,解压缩它,并用它替换您当前的可执行文件。

您也可以使用此实用程序安装特定版本的 Deno

deno upgrade --version 1.0.1

从源代码构建 跳转到标题

有关如何从源代码构建的信息可以在 Contributing 章节中找到。