Skip to content

卸载 CLI

¥Uninstalling the CLI

卸载方法取决于你运行 CLI 的方式。请按照 npx 或全局 npm 安装的说明进行操作。

¥Your uninstall method depends on how you ran the CLI. Follow the instructions for either npx or a global npm installation.

方法 1:使用 npx

¥Method 1: Using npx

npx 从临时缓存中运行软件包,无需永久安装。要“卸载”CLI,您必须清除此缓存,这将删除 gemini-cli 以及之前使用 npx 执行的任何其他软件包。

¥npx runs packages from a temporary cache without a permanent installation. To "uninstall" the CLI, you must clear this cache, which will remove gemini-cli and any other packages previously executed with npx.

npx 缓存是一个名为_npx在你的主 npm 缓存文件夹中。你可以运行以下命令找到你的 npm 缓存路径:npm config get cache

¥The npx cache is a directory named _npx inside your main npm cache folder. You can find your npm cache path by running npm config get cache.

对于 macOS / Linux

¥For macOS / Linux

# The path is typically ~/.npm/_npx
rm -rf "$(npm config get cache)/_npx"

对于 Windows

¥For Windows

命令提示符

¥Command Prompt

:: The path is typically %LocalAppData%\npm-cache\_npx
rmdir /s /q "%LocalAppData%\npm-cache\_npx"

PowerShell

¥PowerShell

# The path is typically $env:LocalAppData\npm-cache\_npx
Remove-Item -Path (Join-Path $env:LocalAppData "npm-cache\_npx") -Recurse -Force

方法 2:使用 npm(全局安装)

¥Method 2: Using npm (Global Install)

如果您全局安装了 CLI(例如,npm install -g @google/gemini-cli),使用npm uninstall命令-g标记以将其删除。

¥If you installed the CLI globally (e.g., npm install -g @google/gemini-cli), use the npm uninstall command with the -g flag to remove it.

npm uninstall -g @google/gemini-cli

此命令将从系统中完全删除该包。

¥This command completely removes the package from your system.