2

我一直有这个问题。我安装的版本是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
4

1 回答 1

1

如果一切都出错了,最好的解决方案是删除并重新安装。这就是我之前所做的。但是那个时候我没有删除的是C:\NuGet文件夹。删除C:\ChocolateyC:\NuGet文件夹后,我再次安装了 Chocolatey,这次运行时没有错误cup,Chocolatey 现在是最新版本 - 0.9.8.20。

于 2012-12-18T03:05:20.887 回答