更新Chocolatey时的RuntimeException

时间:2012-12-17 09:43:42

标签: chocolatey

我一直有这个问题。我安装的版本是0.9.8.11。

PS C:\Chocolatey\lib> cver
The most recent version of chocolatey available from (https://go.microsoft.com/f
wlink/?LinkID=206669) is 0.9.8.20. On your machine you have 0.9.8.11 installed.

Name                           Value
----                           -----
found                          0.9.8.11
foundCompare                   00000.00009.00008.00011
latest                         0.9.8.20
latestCompare                  00000.00009.00008.00020

每次运行命令cupcup all时,都会出现以下错误:

The expression after '&' in a pipeline element produced a object that was not valid. It     must result in a command name, script block or CommandInfo object. At     C:\Nuget\chocolateyInstall\helpers\chocolateyInstaller.psm1:446 char:4
+        & $oc @PSBoundParameters
+         
     + CategoryInfo           : InvalidOperation: (:) [], RuntimeException 
     + FullyQualifiedErrorId: BadExpression

以下是运行cup时的输出:

PS C:\Chocolatey\lib> cup
The most recent version of chocolatey available from (https://go.microsoft.com/f
wlink/?LinkID=206669) is 0.9.8.20. On your machine you have 0.9.8.11 installed.
=====================================================
Chocolatey (0.9.8.11) is installing chocolatey (from https://go.microsoft.com/fw
link/?LinkID=206669) to "C:\NuGet\lib"
=====================================================
Package License Acceptance Terms
-------------------------
Please run chocolatey /? for full license acceptance verbage. By installing you
accept the license for the package you are installing...
-------------------------
-------------------------
NuGet
-------------------------
'chocolatey 0.9.8.20' already installed.

-------------------------
-------------------------
Chocolatey Runner (CHOCOLATEY)
-------------------------
-------------------------
Chocolatey Installation (chocolateyinstall.ps1)
-------------------------
Looking for chocolateyinstall.ps1 in folder C:\NuGet\lib\chocolatey.0.9.8.20
If chocolateyInstall.ps1 is found, it will be run.
-------------------------
Running powershell -NoProfile -ExecutionPolicy unrestricted -Command "& import-m
odule -name  'C:\NuGet\chocolateyInstall\helpers\chocolateyInstaller.psm1'; & 'C
:\NuGet\lib\chocolatey.0.9.8.20\tools\chocolateyInstall.ps1'". This may take awh
ile and permissions may need to be elevated, depending on the package.
-------------------------
Executable Batch Links
-------------------------
Looking for executables in folder: C:\NuGet\lib\chocolatey.0.9.8.20
Adding batch files for any executables found to a location on PATH. In other wor
ds the executable will be available from ANY command line/powershell prompt.
-------------------------
Adding C:\NuGet\bin\NuGet.bat and pointing to C:\NuGet\lib\chocolatey.0.9.8.20\t
ools\chocolateyInstall\NuGet.exe
-------------------------
=====================================================
Chocolatey has finished installing chocolatey
=====================================================

我尝试过去掉巧克力并再次安装。还是一样的。

我还尝试删除C:\Chocolatey\lib\中的巧克力目录并再次运行cup,仍然是同样的错误。

我的powershell版本是3.0

PS C:\Chocolatey\lib> get-host

Name             : ConsoleHost
Version          : 3.0
InstanceId       : 934a43a4-0ccf-47e3-a59a-650f1cf4c6d0
UI               : System.Management.Automation.Internal.Host.InternalHostUserI
                   nterface
CurrentCulture   : en-MY
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

1 个答案:

答案 0 :(得分:1)

如果出现问题,最好的解决方案是删除并重新安装。这就是我以前做的。但我没有删除那段时间的是C:\NuGet文件夹。删除C:\ChocolateyC:\NuGet文件夹后,我再次安装了Chocolatey,这次运行cup时没有错误,而且Chocolatey现在是最新版本 - 0.9.8.20。