安裝
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
從原始碼建置 跳到標題
有關如何從原始碼建置的資訊,請參閱「貢獻
」章節。