Deno is a secure runtime for JavaScript and TypeScript.
Deno lets you use third-party written scripts and modules but does not offer any official package manager like NPM or Yarn. It instead deals with third-party packages a bit differently.
It uses the built-in system to cache third-party scripts and modules. You can change the cache directory with the help of the DENO_DIR
environment variable.
An excellent example of how these caching works are if the file foo.ts requests a third-party module, it will save the module in the cache and then, on the second call, use the store. Now if we have boo.ts
our second file importing the same module will use the cached file.
The regular way of importing third-party modules is the use of url import
, example below.
import { serve } from "https://deno.land/std@0.59.0/http/server.ts";
Code language: JavaScript (javascript)
A quick update to this article, in the initial stages of development, there was no package manager, but now Deno has DPM, Deno’s Package Manager, which is like NPM.
DPM stores the dependencies list in deps.json
and stores the modules in the deno_modules
folder and uses similar commands to NPM.
To install modules using DPM, you can run.
dpm i <module_name>
Code language: HTML, XML (xml)
You can read more about DPM here.
Here is the official list of third-party packages and modules of Deno.
Here is a GitHub issue discussion on the implementation of a package manager.