Deno Package Management
Deno has no standard package management system.
Deno modules are managed in a cache system.
Deno modules or packages are included using the standard "ES module"
import but also supports a fully qualified URL as a module, which allows it to import a module remotely.
When a URL module is specified, this is how Deno handles it:
- Deno downloads the module and caches it imports in a special directory specified by the
DENO_DIRenvironment variable (defaults to the system's cache directory if
DENO_DIRis not specified).
- The next time you run the program, Deno checks for the module in the cache directory, if found, no downloads will be made.
Unlike Node.js, Deno does not have a
package.json which can be used to manage app dependencies, and because it does not have a standard package manager, all modules are downloaded for the first time and managed in the cache system.
However, while the basic philosophy of Deno is to cache all modules, if you still prefer managing your modules with a package management system, there is a third-party package manager already built for Deno which manages your Deno modules like the
Managing Deno Modules with Third-Party Package Manager
A popular and well efficient package called Deno Package Manager
dpm — inspired by
npm has been developed to simulate Node-like package management in Deno by storing Deno modules in a directory called
deno_modules and managing your dependencies inside the
deps.json in your project root directory.
For more information on how to use
dpm visit the official dpm repo.
What You Should Know at the End of This Chapter
- You should know that Deno has no standard package manager.
- You should understand how Deno modules management works.
- You should know there's an
npmalternative for Deno called
dpmeven if you did not choose to work with it.