Skip to main content
On this page

deno unlink

deno unlink 命令会移除使用 deno link 创建的本地包链接,从而使导入再次解析到已发布的注册表版本。它会为你编辑最近的 deno.json 中的 links 数组。

移除链接 Jump to heading

你可以通过路径或通过已链接包的 JSR 名称来移除条目:

>_
# 通过你链接的路径
deno unlink ../my-local-pkg

# 通过包的 JSR 名称
deno unlink @scope/name

路径参数会相对于当前工作目录进行解析,方式与 deno link 相同,因此 deno unlink ../pkg 会匹配由同一目录下的 deno link ../pkg 创建的条目。当 links 数组变为空时,它会被完全移除。

如果没有任何参数匹配到已链接条目,deno unlink 会以非零状态退出,而不是报告成功,因此在脚本和 CI 中可以检测到拼写错误的路径或名称。它永远不会创建 deno.json:如果不存在该文件,就没有可移除的已链接包。

Command line usage:
deno unlink [OPTIONS] [names_or_paths]...

Remove a linked local package from the current project.

deno unlink ../my-local-pkg
deno unlink @scope/name

Accepts either a path that matches an existing entry in the "links" array, or the JSR-style name of a linked package.

Dependency management options Jump to heading

--frozen<BOOLEAN>optional
Jump to heading

Error out if lockfile is out of date.

--lock<FILE>optional
Jump to heading

Check the specified lock file. (If value is not provided, defaults to "./deno.lock").

Disable auto discovery of the lock file.

Options Jump to heading

--lockfile-only
Jump to heading

Install only updating the lockfile.

Last updated on

Did you find what you needed?

编辑此页面
Privacy policy