安装
Deno 可在 macOS、Linux 和 Windows 上运行。Deno 是一个单一的二进制可执行文件。它没有外部依赖项。在 macOS 上,同时提供 M1 (arm64) 和 Intel (x64) 可执行文件。在 Linux 和 Windows 上,仅支持 x64。
下载和安装 跳转到标题
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 跳转到标题
有关官方 Docker 镜像的更多信息和说明:https://github.com/denoland/deno_docker
测试您的安装 跳转到标题
要测试您的安装,请运行 deno --version
。如果这在控制台中打印 Deno 版本,则表示安装成功。
使用 deno help
查看帮助文本,其中记录了 Deno 的标志和用法。在此处获取有关 CLI 的详细指南 here。
更新 跳转到标题
要更新先前安装的 Deno 版本,您可以运行
deno upgrade
或使用 Winget (Windows)
winget upgrade DenoLand.Deno
这将从 github.com/denoland/deno/releases 获取最新版本,解压缩它,并用它替换您当前的可执行文件。
您也可以使用此实用程序来安装特定版本的 Deno
deno upgrade --version 1.0.1
从源代码构建 跳转到标题
有关如何从源代码构建的信息可以在Contributing
章节中找到。