【问题标题】:How can I install Chocolatey with the file chocolatey.0.10.15.nupkg?如何使用文件 Chocolatey.0.10.15.nupkg 安装 Chocolatey?
【发布时间】:2020-10-07 22:33:58
【问题描述】:

我在带有 Chocolatey 链接的 PowerShell 控制台中出现错误。

chocolatey's link error

如果没有解决方案,我需要学习如何使用下载的文件“chocolatey.0.10.15.nupkg”安装 Chocolatey。

chocolatey's file .nupkg

【问题讨论】:

    标签: powershell nuget chocolatey


    【解决方案1】:

    安装 choco 是一个非常常见的用例,包括 NuGet。

    PowerShell 已经附带了一个包管理器,它使用默认情况下已经安装的 NuGet。您仍然可以出于其他原因安装 choco,但对于日常正常 PowerShell 使用,不需要它。

    安装 PowerShellGet https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-7

    PowerShellGet 是以下版本 Windows 10 中的内置模块 或更新的 Windows Server 2016 或更新的 Windows 管理框架 (WMF) 5.0 或更新的 PowerShell 6

    在您的 PowerShell 会话中设置您的安全级别。

    # Required for use with web SSL sites
    [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
    

    如果您的 ExecutionPolicy 设置为 AllSigned,那么您运行的任何脚本都必须经过签名。否则,请在您的用户会话中将 ExecutionPolicy 设置为 RemoteSigned 或 ByPass。

    How to Install Chocolatey using PowerShell

    Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression (
        (New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
    )
    

    【讨论】:

    • 感谢您的回答!我有 Windows 7 和 PowerShell 2.0。我按照你的步骤做,但我仍然有一个错误。 Excepción al llamar a "DownloadString" con los argumentos "1": "Se ha terminado la conxión: Error inesperado de envío." En línea: 1 Carácter: 118 + Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString chocolatey.org/install.ps1')) + CategoryInfo: NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
    • 如果这是您的个人机器,请将您的 PS 版本升级到 PSv5x。 PS2 不再受支持 (depreciated) 并且确实不应再使用。另外,choco 有系统要求.. Does your system meet the requirements?
    • 我通过下载包含 PowerShell 5.1 的 Windows Management Framework 5.1 安装了 Chocolatey。非常感谢!!
    猜你喜欢
    • 2019-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多