Skip to main content

TomAlcala

Deno Version Management

Table of Contents

Deno glitch logo Logo © Samip Poudel

Deno is really nice! Version managers are nice too, they offer a way to have several versions of a runtime, dependencies installed at a user level, without breaking system runtime if any.

Here we will use one version manager to install the Deno runtime 😀.

# Lexicon

## Deno

Deno is a JavaScript/TypeScript runtime that can replace NodeJS, with the aim to be more secure.

# Deno Runtime Installation

## Standard Installation

There are a bunch of scripts to install the Deno runtime in the official documentation, depending on your operating system. Deno is written in Rust, so you can also install it with cargo, the Rust package manager.

## dvm

The real topic of this post!

dvm (Deno Version Manager) is a version manager inspired by fnm, a fast NodeJS version manager.

### Installation

You can get it from the GitHub release page or with opam if you work with OCaml, it is written in OCaml.

$ opam pin add dvm https://github.com/imbsky/dvm.git 
$ opam install dvm

For Windows, your best bet is probably the OPAM approach, or WSL.

### Initialization

It is not as mature as fnm, so what you have to do next is:

  1. Install a Deno runtime
    $ dvm install 1.1.3

  2. Use the Deno runtime
    $ dvm use 1.1.3

  3. Add the Deno runtime to your PATH
    Add this line to your shell rc: export PATH="$HOME/.dvm/current:$PATH"

### Test the Runtime

Deno hosts an example file with a single line console log in it. You can test your runtime with it like this:

$ deno run https://deno.land/std/examples/welcome.ts  

# This is it! 🎊