如何卸载使用 npm 链接安装的软件包? [英] How do I uninstall a package installed using npm link?

查看:149
本文介绍了如何卸载使用 npm 链接安装的软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用包目录中的sudo npm link安装节点包时,如何在完成开发后卸载该包?

When installing a node package using sudo npm link in the package's directory, how can I uninstall the package once I'm done with development?

npm link 将软件包安装为系统全局软件包位置 ('/usr/local/lib`) 中的符号链接.这使您可以在开发包的同时对其进行测试,而无需一遍又一遍地安装它.

npm link installs the package as a symbolic link in the system's global package location ('/usr/local/lib`). This allows you to test the package while still developing it, without having to install it over and over again.

我需要运行哪个 npm 命令才能再次删除链接?

Which npm command do I need to run to remove the link again?

推荐答案

可以使用相同的 uninstallrm 命令卸载软件包,这些命令可用于删除已安装的包.唯一要记住的是,需要全局卸载链接 - 需要提供 --global 标志.

The package can be uninstalled using the same uninstall or rm command that can be used for removing installed packages. The only thing to keep in mind is that the link needs to be uninstalled globally - the --global flag needs to be provided.

为了卸载全局链接的foo包,可以使用以下命令(如果需要,使用sudo,取决于你的设置和权限)

In order to uninstall the globally linked foo package, the following command can be used (using sudo if necessary, depending on your setup and permissions)

sudo npm rm --global foo

这将卸载软件包.

要检查是否安装了包,可以使用 npm ls 命令:

To check whether a package is installed, the npm ls command can be used:

npm ls --global foo

这篇关于如何卸载使用 npm 链接安装的软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆