Skip to main content
On this page

deno 升级

示例 Jump to heading

升级到最新版本 Jump to heading

使用此命令且不带任何选项即可将 Deno 升级到可用的最新版本:

>_
deno upgrade
正在检查最新版本
已找到版本
Deno 正在升级到版本 1.38.5
正在下载 https://github.com/denoland/deno/releases/download/v1.38.5/deno-x86_64-apple-darwin.zip
正在下载 100%
升级成功完成

升级到指定版本 Jump to heading

你可以指定要升级到的特定版本:

>_
deno upgrade --version 1.37.0
正在检查版本 1.37.0
已找到版本
Deno 正在升级到版本 1.37.0
正在下载 https://github.com/denoland/deno/releases/download/v1.37.0/deno-x86_64-apple-darwin.zip
正在下载 100%
升级成功完成

检查可用升级但不安装 Jump to heading

使用 --dry-run 标志可以查看将会升级到哪个版本,而不实际进行升级:

>_
deno upgrade --dry-run
正在检查最新版本
已找到版本
将升级到版本 1.38.5

--quiet 标志 Jump to heading

--quiet 标志在升级过程中抑制诊断输出。用在 deno upgrade 时,它将隐藏进度指示、下载信息和成功消息。

>_
deno upgrade --quiet

这对于脚本环境或在 CI 流水线中想要更简洁的输出非常有用。

缓存下载 Jump to heading

下载的 Deno 二进制文件会缓存到 $DENO_DIR/dl/。如果你之后重新安装相同版本,会重用缓存的归档文件而不是重新下载。对于 canary 版本,旧条目会自动被移除,只保留最近 10 个版本。

校验和验证 Jump to heading

使用 --checksum 标志可以将下载的二进制文件与已知的 SHA-256 哈希值进行验证。这可以防止在 CI 环境和安全敏感的设置中遭到篡改:

>_
deno upgrade --checksum=<sha256-hash> 2.7.0

SHA-256 校验和作为 .sha256sum 文件随发布归档一同发布在 GitHub 上:

>_
curl -sL https://github.com/denoland/deno/releases/download/v2.7.0/deno-x86_64-unknown-linux-gnu.zip.sha256sum

Canary 版本 Jump to heading

默认情况下,Deno 会从官方的 GitHub 发行版升级。你可以使用 --canary 构建标志来升级到最新的 canary 版本:

>_
# 升级到最新的 canary 构建
deno upgrade --canary
Command line usage:
deno upgrade [OPTIONS] [VERSION]...

Upgrade deno executable to the given version.

Latest Jump to heading

deno upgrade

Specific version Jump to heading

deno upgrade 1.45.0
deno upgrade 1.46.0-rc.1
deno upgrade 9bc2dd29ad6ba334fd57a20114e367d3c04763d4

Channel Jump to heading

deno upgrade stable
deno upgrade alpha
deno upgrade beta
deno upgrade rc
deno upgrade canary

The version is resolved via https://dl.deno.land and then downloaded from either there or GitHub releases, replacing the current executable.

If you want to not replace the current Deno executable but instead download an update to a different location, use the --output flag:

deno upgrade --output $HOME/my_deno

Upgrade options Jump to heading

--checksum<checksum>
Jump to heading

Verify the downloaded archive against the provided SHA256 checksum.

Perform all checks without replacing old exe.

--force, -f
Jump to heading

Replace current exe even if not out-of-date.

--output<output>
Jump to heading

The path to output the updated version to.

Options Jump to heading

--cert<FILE>
Jump to heading

Load certificate authority from PEM encoded file.

Last updated on

你找到了你需要的东西吗?

编辑此页面
隐私政策