Introduction
Just like Node.js, Deno, the secure runtime for JavaScript and TypeScript, also evolves rapidly. Sometimes, you might need to work with different Deno versions for different projects. That's where DVM – Deno Version Manager comes to the rescue!
Think of DVM as your personal Deno version control center. It lets you easily install, switch between, and manage multiple Deno versions on your computer. No more juggling installations or worrying about version conflicts!
Why Use DVM?
- Project Compatibility: Some projects might require a specific Deno version. DVM lets you quickly switch to the right version for each project.
- Easy Testing: Want to see if your code works on an older or the latest Deno? DVM makes it a breeze to test across different versions.
- Keep Things Clean: DVM keeps each Deno version separate, preventing conflicts and making your setup organized.
- Global Deno Management: Install Deno once with DVM, and then manage versions globally without messy manual installations.
Getting Started with DVM
Let's get DVM up and running. The installation is straightforward:
For macOS/Linux (using curl):
$ curl -fsSL https://deno.land/x/dvm/install.sh | sh
For macOS/Linux (using wget):
$ wget -qO- https://deno.land/x/dvm/install.sh | sh
For Windows (PowerShell):
$ iex "& { $(irm https://deno.land/x/dvm/install.ps1) }"
After installation, close and reopen your terminal or run:
$ source ~/.dvm/dvm.sh # For bash/zsh
or
$ . $HOME.dvmdvm.ps1 # For PowerShell
Basic DVM Commands You'll Use Every Day
Once DVM is installed, here are the commands you'll use most often:
-
Install a Deno Version:
Let's say you want to install Deno version
v1.30.3
. Just run:$ dvm install 1.30.3
DVM will download and install that specific version for you. You can install multiple versions this way!
-
Use a Specific Deno Version:
To switch to and use the Deno version you just installed (or any other installed version), use the
use
command:$ dvm use 1.30.3
Now, when you run
deno --version
, it will showv1.30.3
. DVM makes this version active in your current terminal session. -
List Installed Deno Versions:
Want to see which Deno versions you have installed using DVM? Simple:
$ dvm list
This will show you a list of all the Deno versions managed by DVM on your system.
-
Uninstall a Deno Version:
If you no longer need a specific version, you can easily remove it:
$ dvm uninstall 1.30.3
This will free up space and keep your DVM installation tidy.
-
Using the Latest Deno Version:
If you want to quickly use the latest stable Deno version, you can often just use:
$ dvm use latest
DVM will fetch and use the most recent stable release. (Note: Always double-check if
latest
behaves as expected and refers to stable in DVM documentation).
Conclusion
This article introduced you to DVM – a Deno version manager. Remember to always refer to the official DVM documentation for the most up-to-date and detailed information!
This article was written by Ahmad Adel . Ahmad is a freelance writer and also a backend developer.