2017-05-09 105 views
0

通過Powershell安裝Chocolatey的步驟並不適用於我的Windows 7 64位個人電腦。我下面https://chocolatey.org/install#install-from-powershell-v3巧克力不會安裝

  • 我已經證實了ExecutionPolicy和系統路徑具有 PowerShell的;

    PS C:\Users\a> Get-ExecutionPolicy 
    AllSigned 
    
    PS C:\Users\a> ($env:Path).split(';') 
    %SystemRoot%\system32\WindowsPowerShell\v1.0\ 
    C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common 
    C:\Program Files (x86)\Intel\iCLS Client\ 
    C:\Program Files\Intel\iCLS Client\ 
    C:\ProgramData\Oracle\Java\javapath 
    C:\Windows\system32 
    C:\Windows 
    C:\Windows\System32\Wbem 
    C:\Windows\System32\WindowsPowerShell\v1.0\ 
    C:\Program Files\Java\jre1.8.0_40\bin 
    C:\Program Files\Java\jdk1.8.0_40\bin 
    C:\Program Files (x86)\AMD\ATI.ACE\Core-Static 
    C:\Windows\System32\WindowsPowerShell\v1.0\ 
    C:\Program Files\Intel\Intel(R) Management Engine Components\DAL 
    C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL 
    C:\Program Files\Intel\Intel(R) Management Engine Components\IPT 
    C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT 
    C:\HashiCorp\Vagrant\bin 
    C:\Program Files (x86)\Git\bin 
    C:\Program Files (x86)\Skype\Phone\ 
    C:\Program Files (x86)\Git\bin 
    C:\Program Files (x86)\Git\libexec\git-core 
    
    C:\Program Files (x86)\Nmap 
    C:\Program Files\smartmontools\bin 
    
  • 這是我的錯誤消息;

    PS C:\Users\a> iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex 
    ???# : The term '???#' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
    At line:1 char:1 
    + ???# ===================================================================== 
    + ~~~~ 
        + CategoryInfo   : ObjectNotFound: (???#:String) [], CommandNotFoundException 
        + FullyQualifiedErrorId : CommandNotFoundException 
    
    Getting latest version of the Chocolatey package for download. 
    Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.5. 
    !Test-Path : The term '!Test-Path' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
    At line:188 char:11 
    + } elseif (!Test-Path $7zaExe) { 
    +   ~~~~~~~~~~ 
        + CategoryInfo   : ObjectNotFound: (!Test-Path:String) [], CommandNotFoundException 
        + FullyQualifiedErrorId : CommandNotFoundException 
    
    Extracting C:\Users\a\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\a\AppData\Local\Temp\chocolatey\chocInstall... 
    Exception calling "Start" with "0" argument(s): "The system cannot find the file specified" 
    At line:211 char:3 
    + $process.Start() | Out-Null 
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
        + CategoryInfo   : NotSpecified: (:) [], MethodInvocationException 
        + FullyQualifiedErrorId : Win32Exception 
    
    Exception calling "BeginOutputReadLine" with "0" argument(s): "StandardOut has not been redirected or the process hasn't started yet." 
    At line:212 char:3 
    + $process.BeginOutputReadLine() 
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
        + CategoryInfo   : NotSpecified: (:) [], MethodInvocationException 
        + FullyQualifiedErrorId : InvalidOperationException 
    
    Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object." 
    At line:213 char:3 
    + $process.WaitForExit() 
    + ~~~~~~~~~~~~~~~~~~~~~~ 
        + CategoryInfo   : NotSpecified: (:) [], MethodInvocationException 
        + FullyQualifiedErrorId : InvalidOperationException 
    
    Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install again. Error: 7-Zip signalled an unknown error (code) 
    At line:225 char:15 
    +  default { throw "$errorMessage 7-Zip signalled an unknown error (code $exitC ... 
    +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
        + CategoryInfo   : OperationStopped: (Unable to unzip...n error (code):String) [], RuntimeException 
        + FullyQualifiedErrorId : Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install again. Error: 7-Zip signalled an unknown error (code) 
    
  • 我試圖在最後一行

    Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' 
    

    但是,這不僅導致了一系列其他錯誤

+0

的AllSigned目前不會因工作在PowerShell中的一些發現的問題,我們一起到PowerShell團隊通過。當0.10.6出來時它會再次工作。至於另一個問題,今天介紹了BOM,以確保authenticode在非BOM文件中的unicode字符(我們最近發現的第二個問題)上不會失敗 - 請提出一個適當的問題,以便我們能夠修復它。 – ferventcoder

+0

https://github.com/chocolatey/choco(儘管我們已經對allsigned有問題並已修復此問題)和https://github.com/chocolatey/chocolatey.org以獲取BOM install.ps1腳本。謝謝! – ferventcoder

+0

我在https://github.com/chocolatey/chocolatey.org/issues/512提交了此問題 – ferventcoder

回答

1
 
PS C:\admin\scripts>iwr https://chocolatey.org/install.ps1 -UseBasicParsing 


StatusCode  : 200 
StatusDescription : OK 
Content   : # ===================================================================== 
... 

你的錯誤消息的建議下載一個UTF-8編碼的文件(內容以UTF-8的特徵開始byte order mark ),但它被視爲ASCII文本。

除了:

我下面https://chocolatey.org/install#install-from-powershell-v3

不,你不是。你引用的網站告訴你使用

iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 

,而你正在嘗試使用

iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex 

如果你想用這種方法,你需要從內容中刪除BOM這像宣傳的那樣,管道入Invoke-Expression前:

(iwr https://chocolatey.org/install.ps1 -UseBasicParsing).Content -replace '^' | iex 
+0

如果你點擊更多的選項,你會看到他鏈接的東西 - 你會希望PowerShell能夠正確處理文件,看看它是UTF8 b/c BOM(但很明顯,情況並非如此)。 – ferventcoder

+0

當頭版上有一個正常工作時,我傾向於不通過「更多選項」。 –