English | 简体ä¸ć–‡
DVM is a lightweight and powerful Deno version manager for macOS, Linux, WSL, and Windows with Bash.
Note for Windows users: You must install DVM v0.7.0 or later, and you also need a Bash shell to use this tool. For example, you can install WSL and run the bash
command in PowerShell.
Warning
Do not use the deno upgrade
command to upgrade Deno after you have installed Deno with DVM.
There are two ways to install DVM.
- Install DVM from the network using the following command:
curl -o- "https://raw.githubusercontent.com/ghosind/dvm/master/install.sh" | bash
For users in China, you can install DVM from Gitee using the following command:
curl -o- "https://gitee.com/ghosind/dvm/raw/master/install.sh" | DVM_SOURCE=gitee bash
- Clone this project and execute the
install.sh
script:
git clone "https://github.com/ghosind/dvm.git"
# you can also clone it from gitee
# git clone "https://gitee.com/ghosind/dvm.git"
cd dvm
./install.sh
After installing DVM, restart your terminal or run source <your_profile_file>
to apply the changes.
The default installation location is ~/.dvm
. You can use the -d <dir>
option (for local installs only) or the $DVM_DIR
environment variable to specify a different directory.
curl -o- "https://raw.githubusercontent.com/ghosind/dvm/master/install.sh" | DVM_DIR=~/deno/dvm bash
./install.sh -d ~/deno/dvm
Since DVM v0.3.0
, the upgrade
command is available to update DVM to the latest version.
dvm upgrade
If you are using a DVM version older than v0.3.0
, you may need to uninstall the current version and reinstall the latest one. See the Manual uninstall section for instructions.
Please ensure you have the following dependencies installed:
- curl
- git
- unzip (for Deno v0.36.0 and newer versions)
- gunzip (for Deno v0.35.0 and lower versions)
To install Deno from source, you will also need:
- rustc
- cargo
- cc
- cmake
After installing DVM, you can use it to manage multiple Deno versions and environments.
Use dvm list-remote
or dvm ls-remote
to list all available Deno versions from the remote server.
# list all available versions
dvm list-remote
# ls-remote is an alias for list-remote command
dvm ls-remote
Use dvm list
or dvm ls
to list all installed Deno versions.
# list all installed versions
dvm list
# ls command is an alias for list command
dvm ls
Use the dvm install <version>
command to download and install a specific Deno version.
dvm install v1.0.0
# Deno v1.0.0 has been installed.
# Using Deno v1.0.0 now.
dvm install v0.42.0
# Deno v0.42.0 has been installed.
# Using Deno v1.0.0 now.
Since DVM v0.8.0, you can install Deno from source using the --from-source
option.
dvm install --from-source v1.35.0
Use the dvm uninstall <version|alias-name>
command to uninstall a specific version or alias.
dvm uninstall v0.39.0
# Uninstalled Deno v0.39.0.
# default is an alias name
dvm uninstall default
# Uninstalled Deno default.
Use the dvm use [version]
command to link deno
to the specified installed version, either by parameter or from a .dvmrc
file.
# Use v1.0.0
dvm use v1.0.0
# Using Deno v1.0.0 now.
If you do not specify a version, DVM will try to read the .dvmrc
file from the current working directory.
# cat .dvmrc
# # v1.4.0
dvm use
# Found './dvmrc' with version v1.4.0
# Using Deno v1.4.0 now.
Setting the active version with the use
command only affects the current terminal session. To set a default version for all terminal sessions, create a default
alias. See the Set an alias section for more details.
Use the dvm current
command to display the currently active Deno version.
dvm current
# v1.0.0
Use the dvm alias
command to set an alias for an installed Deno version.
dvm ls
# v1.0.0
# Set the default alias
dvm alias default v1.0.0
# default -> v1.0.0
dvm ls
# v1.0.0
# default -> v1.0.0
Use the dvm run
command to run Deno with the specified version and arguments.
dvm run v1.0.0
# Running with deno v1.0.0
# Deno 1.0.0
# exit using ctrl+d or close()
# >
You can also run a script file with the specified Deno version.
# Run app.ts with Deno v1.0.0
dvm run v1.0.0 app.ts
DVM supports the following commands:
Command | Usage | Description |
---|---|---|
install |
dvm install |
Download and install the latest version or the version reading from .dvmrc file. |
dvm install <version | prefix> |
Download and install the specified version, or the latest version with the specified prefix. | |
dvm install <version> --registry=<registry> |
Download and install deno with the specified registry. | |
dvm install <version> --skip-validation |
Do not validate deno version before trying to download it. | |
dvm install <version> --from-source |
Build and install Deno from source code. | |
dvm install <version> --skip-download-cache |
Download and install Deno without using downloaded cache. | |
dvm install <version> --sha256sum |
Download and install Deno with sha256sum check. | |
uninstall |
dvm uninstall <version> |
Uninstall the specified version. |
use |
dvm use |
Use the specified version read from .dvmrc. |
dvm use <version> |
Use the specified version that passed by argument. | |
dvm use <name> |
Use the specified version of the alias name that passed by argument. | |
run |
dvm run <version> [args] |
Run deno on the specified version with arguments. |
alias |
dvm alias <name> <version> |
Set an alias name to specified version. |
unalias |
dvm unalias <name> |
Delete the specified alias name. |
current |
dvm current |
Display the current version of Deno. |
ls |
dvm ls |
List all installed versions. |
list |
dvm list |
Same as ls command. |
ls-remote |
dvm ls-remote |
List all remote versions. |
list-remote |
dvm list-remote |
Same as ls-remote command. |
which |
dvm which |
Display the path of the version that specified in .dvmrc. |
dvm which current |
Display the path of the current version. | |
dvm which <version> |
Display the path of specified version. | |
clean |
dvm clean |
Remove all downloaded packages and the cached versions. |
deactivate |
dvm deactivate |
Deactivate Deno on current shell. |
doctor |
dvm doctor |
Find invalid / corrupted versions. |
dvm doctor --fix |
Find and fix invalid / corrupted versions. | |
upgrade |
dvm upgrade |
Update dvm itself. |
purge |
dvm purge |
Remove dvm from your computer. |
help |
dvm help |
Show dvm help message. |
For more details, please visit the DVM Wiki.
Option | Description |
---|---|
-q , --quiet |
Run DVM with quiet mode, it'll hide most of the outputs. |
--color |
Print messages with color mode. |
--no-color |
Print messages with no color mode. |
--verbose |
Print debug messages. |
You can remove DVM from your computer in two ways:
You can run dvm purge
to remove DVM from your computer if your DVM version is v0.3.2
or above. This will remove the $DVM_DIR
and DVM configuration from your shell config file.
If your DVM version is older than v0.3.2
, please follow the next section (Manual uninstall) to remove DVM.
Alternatively, you can run the following command to uninstall DVM:
rm -rf "$DVM_DIR"
Edit your shell config file (such as .bashrc
or .zshrc
) and remove the following lines:
# Deno Version Manager
export DVM_DIR="$HOME/.dvm"
[ -f "$DVM_DIR/dvm.sh" ] && . "$DVM_DIR/dvm.sh"
[ -f "$DVM_DIR/bash_completion" ] && . "$DVM_DIR/bash_completion"
Distributed under the MIT License. See the LICENSE file for more information.