安装openvpn时Chocolatey返回错误

时间:2019-04-26 20:57:43

标签: powershell windows-10 package-managers openvpn chocolatey

如标题所述,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 个答案:

答案 0 :(得分:1)

我发现了一种解决方案,该解决方案禁用了git PATH,因为它会将git随附的gpg.exe的版本放在环境变量中openvpn包中的git之前。

这可以通过两种方式完成;

首先是编辑环境PATH变量并将git PATH移到C:\Program Files (x86)\GNU\GnuPG\pub PATH下方,请参见下图。 enter image description here

第二个是删除/删除git PATH变量,然后开始一个新的powershell会话,运行choco install openvpn,然后将git PATH返回到env变量。 / p>

就我而言,第一个选项很好用。