To improve dependency management, Deno 2.0 introduces a deno add
subcommand to handle specifiers with a subpath. In addition, if a project contains a package.json file, Deno will prefer adding npm:
dependencies to package.json rather than deno.json
. Developers can add “dev dependencies” to package.json using the --dev
flag. Also with Deno 2.0, deno install
now supports the --entrypoint
flag, which allows for installing all dependencies from a given module. And a new deno remove
subcommand has been added to quickly remove some dependencies. Deno 2.0 also ships with a more concise lockfile format (v4) to minimize diffs when updating dependencies and ensuring reproducible builds. Additionally, Deno has improved error messaging, providing hints for common issues such as incorrectly formatted relative import paths or missing dependencies when using “bare specifiers.” DenoLand said the updates collectively streamline the process of managing dependencies in Deno projects, making it more intuitive and aligned with modern development workflows.
The Deno permission system also gets attention in Deno 2.0. With version 2.0, a lack of Deno permissions now raises the Deno.errors.Notcapable
error instead of Deno.errors.PermissionDenied
, making it easier to discriminate between OS-level errors and Deno errors. Also, the permissions check for the Deno.mainModule
API, which gives a pull path to the main module, has been relaxed and no longer requires full --allow-read
permission. This also applies to the process.argv
API. It also is now possible to grant permissions for reading and writing files that contain commas in the file name.
Other new features and changes in Deno 2.0: