安装
Deno 可在 macOS、Linux 和 Windows 上运行。Deno 是一个单一的二进制可执行文件。它没有外部依赖。在 macOS 上,提供了 M1 (arm64) 和 Intel (x64) 两种可执行文件。在 Linux 和 Windows 上,仅支持 x64。
下载与安装 Jump to heading
deno_install 提供了方便的脚本来下载和安装二进制文件。
使用 Shell
curl -fsSL https://deno.land/install.sh | sh
使用 npm
npm install -g deno
如果通过 npm 安装 Deno 命令,其启动时间会受到影响。为了获得更好的性能,我们推荐使用 shell 安装脚本。
使用 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 set -u deno latest
# To set as the default version of Deno locally (current project only)
asdf set 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
使用 npm
npm install -g deno
如果通过 npm 安装 Deno 命令,其启动时间会受到影响。为了获得更好的性能,我们推荐使用 PowerShell 安装脚本。
使用 Scoop
scoop install deno
使用 Chocolatey
choco install deno
使用 Winget
winget install DenoLand.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
使用 npm
npm install -g deno
如果通过 npm 安装 Deno 命令,其启动时间会受到影响。为了获得更好的性能,我们推荐使用 shell 安装脚本。
使用 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 set -u deno latest
# To set as the default version of Deno locally (current project only)
asdf set 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 Jump to heading
有关官方 Docker 镜像的更多信息和说明:https://github.com/denoland/deno_docker
测试安装 Jump to heading
要测试您的安装,请运行 deno --version
。如果控制台打印出 Deno 版本,则表示安装成功。
使用 deno help
查看 Deno 标志和用法的帮助文本。有关 CLI 的详细指南,请点击此处。
更新 Jump to heading
要更新之前安装的 Deno 版本,您可以运行
deno upgrade
或使用 Winget (Windows)
winget upgrade DenoLand.Deno
这将从 github.com/denoland/deno/releases 获取最新版本,解压它,并用它替换您当前的可执行文件。
您也可以使用此实用程序安装特定版本的 Deno
deno upgrade --version 1.0.1
从源代码构建 Jump to heading
有关如何从源代码构建的信息,请参阅从源代码构建
指南。