Back to Denoland

deno uninstall

runtime/reference/cli/uninstall.md

latest1.4 KB
Original Source

deno uninstall [PACKAGES]

Remove dependencies specified in deno.json or package.json:

shell
$ deno add npm:express
Add npm:[email protected]

$ cat deno.json
{
  "imports": {
    "express": "npm:[email protected]"
  }
}
shell
$ deno uninstall express
Removed express

$ cat deno.json
{
  "imports": {}
}

:::tip

You can also use deno remove which is an alias to deno uninstall [PACKAGES]

:::

You can remove multiple dependencies at once:

shell
$ deno add npm:express jsr:@std/http
Added npm:[email protected]
Added jsr:@std/[email protected]

$ cat deno.json
{
  "imports": {
    "@std/http": "jsr:@std/http@^1.0.7",
    "express": "npm:express@^5.0.0",
  }
}
shell
$ deno remove express @std/http
Removed express
Removed @std/http

$ cat deno.json
{
  "imports": {}
}

:::info

While dependencies are removed from the deno.json and package.json they still persist in the global cache for future use.

:::

If your project contains package.json, deno uninstall can work with it too:

shell
$ cat package.json
{
  "dependencies": {
    "express": "^5.0.0"
  }
}

$ deno remove express
Removed express

$ cat package.json
{
  "dependencies": {}
}

deno uninstall --global [SCRIPT_NAME]

Uninstall serve

bash
deno uninstall --global serve

Uninstall serve from a specific installation root

bash
deno uninstall -g --root /usr/local/bin serve