removal

清理 Slate

选择命令行版本:

概要

¥Synopsis

看到你走真难过。

¥So sad to see you go.

sudo npm uninstall npm -g

或者,如果失败,请获取 npm 源代码,然后执行以下操作:

¥Or, if that fails, get the npm source code, and do:

sudo make uninstall

更严重的卸载

¥More Severe Uninstalling

通常,上述说明就足够了。这将删除 npm,但留下你已安装的任何内容。

¥Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed.

如果这不起作用,或者如果你需要更严厉的措施,请继续阅读。

¥If that doesn't work, or if you require more drastic measures, continue reading.

请注意,这仅对全局安装的包是必需的。本地安装完全包含在项目的 node_modules 文件夹中。删除该文件夹,一切都消失了,包的安装脚本特别不正常)。

¥Note that this is only necessary for globally-installed packages. Local installs are completely contained within a project's node_modules folder. Delete that folder, and everything is gone less a package's install script is particularly ill-behaved).

这假设你在默认位置安装了 node 和 npm。如果你使用不同的 --prefix 配置 node,或者使用不同的前缀设置安装 npm,则相应地调整路径,将 /usr/local 替换为你的安装前缀。

¥This assumes that you installed node and npm in the default place. If you configured node with a different --prefix, or installed npm with a different prefix setting, then adjust the paths accordingly, replacing /usr/local with your install prefix.

要手动删除所有与 npm 相关的内容:

¥To remove everything npm-related manually:

rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*

如果你用 npm 安装了东西,那么最好的办法是先用 npm 卸载它们,然后在正确安装后再次安装它们。这可以帮助找到周围的任何符号链接:

¥If you installed things with npm, then your best bet is to uninstall them with npm first, and then install them again once you have a proper install. This can help find any symlinks that are lying around:

ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm

在 0.3 版之前,npm 将 shim 文件用于可执行文件和 node 模块。要追踪这些,你可以执行以下操作:

¥Prior to version 0.3, npm used shim files for executables and node modules. To track those down, you can do the following:

find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ;

也可以看看

¥See also

npm 中文网 - 粤ICP备13048890号