Chocolatey 在安装 openvpn 时抛出错误

Chocolatey 在安装 openvpn 时抛出错误

正如标题所述,choco install openvpn返回以下错误;

ERROR: Unable to import PGP key C:\ProgramData\chocolatey\lib\openvpn\tools\openvpn_public_key.asc' in the temporary keyring (C:\ProgramData\chocolatey\lib\openvpn\tools\e090a0df-7709-xxxx-xxxx-xxxxxxxxxxxx\pubring.gpg). The install of openvpn was NOT successful. Error while running C:\ProgramData\chocolatey\lib\openvpn\tools\chocolateyInstall.ps1'. See log for details.

Failures - openvpn (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\openvpn\tools\chocolateyInstall.ps1'. See log for details.

我正在使用一台Windows 10, v1803机器。

编辑

显示完整跟踪错误的日志部分;

[DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\openvpn.2.4.7\.arguments". [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\openvpn.2.4.7\.extra". [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\openvpn.2.4.7\.version". [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\openvpn.2.4.7\.sxs". [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\openvpn.2.4.7\.pin". [DEBUG] - Attempting to delete directory "C:\ProgramData\chocolatey\lib-bad\openvpn". [DEBUG] - Sending message 'HandlePackageResultCompletedMessage' out if there are subscribers... [ERROR] - The install of openvpn was NOT successful. [ERROR] - Error while running 'C:\ProgramData\chocolatey\lib\openvpn\tools\chocolateyInstall.ps1'. See log for details. [DEBUG] - Moving 'C:\ProgramData\chocolatey\lib\openvpn' to 'C:\ProgramData\chocolatey\lib-bad\openvpn' [DEBUG] - Attempting to delete file "C:\Users\XXX\AppData\Local\NuGet\Cache\openvpn.2.4.7.nupkg". [WARN ] - Chocolatey installed 0/1 packages. 1 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log). [INFO ] - [ERROR] - Failures [ERROR] - - openvpn (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\openvpn\tools\chocolateyInstall.ps1'. See log for details. [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers... [DEBUG] - Exiting with -1

答案1

我找到了解决方案,即禁用git所使用的 PATH,因为它将 git 附带的版本放在环境变量中的包版本gpg.exe之前。openvpn

这可以通过两种方式实现;

第一是编辑环境PATH变量,将gitPATH移到C:\Program Files (x86)\GNU\GnuPG\pubPATH下面,见下图。 在此处输入图片描述

第二种是移除/删除gitPATH 变量,然后启动新powershell会话,运行choco install openvpn,然后将gitPATH 返回到环境变量。

就我的情况来说,第一个选项就很好用。

相关内容