gpt4 book ai didi

shell - Chocolatey `Get-ExecutionPolicy` - 未捕获的 ReferenceError : Get is not defined

转载 作者:行者123 更新时间:2023-12-04 12:11:34 25 4
gpt4 key购买 nike

我正在关注 Chocolately Install步骤(Windows 7),但遇到了一些问题。

首先,我开通了命令提示符 (用 以管理员身份运行 打开),但是当试图执行时 Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) ,我收到此错误:

Uncaught SyntaxError: Unexpected identifier



..与 https:我的命令的一部分突出显示。

此外,当我尝试执行 Get-ExecutionPolicy 时,它导致:

Uncaught ReferenceError: Get is not defined



任何想法可能是错误的?

* 更新 *

当我在 中尝试相同的命令时PowerShell ,我收到此错误:

PS C:\Users\mylogin> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtoc ol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString ('https://chocolatey.org/install.ps1')) Exception setting "SecurityProtocol": "Cannot convert value "3312" to type "System.Net.SecurityProtocolType" due to inv alid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "Ssl3, Tls"." At line:1 char:85 + Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]:: <<<< SecurityProtocol = [System. Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://ch ocolatey.org/install.ps1')) + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyAssignmentException

Exception calling "DownloadString" with "1" argument(s): "The underlying connection was closed: An unexpected error occ urred on a send." At line:1 char:219 + Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.Se rvicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString <<<< ('https://ch ocolatey.org/install.ps1')) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException

最佳答案

Chocolatey.org requires TLS 1.2能够连接。此错误表明您不支持已安装的:

System.Net.WebClient).DownloadString ('https://chocolatey.org/install.ps1')) Exception setting "SecurityProtocol": "Cannot convert value "3312" to type "System.Net.SecurityProtocolType" due to inv alid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "Ssl3, Tls"

我之前链接的博客文章中的部分应该会有所帮助:

If you find yourself provisioning machines such as Windows 7, Windows Server 2008, or older, you will find that those machines will not be able to communicate with the Chocolatey Community Repository after we implement this change. For those instances, you will need to use alternative installation methods for Chocolatey. We strongly recommend using the offline Chocolatey installation as it provides the most flexibility and reliability.



关于 Chocolatey install page要求如下:
  • Windows 7+/Windows Server 2003+
  • PowerShell v2+(由于 TLS 1.2 requirement,从本网站安装的最低版本为 v3)
  • .NET Framework 4+(如果您没有安装,安装将尝试安装 .NET 4.0)(由于 TLS 1.2 requirement,从本网站安装的最低版本为 4.5)

  • 我的建议是完全修补您的 Windows 7 系统,安装 .NET 4.5,然后尝试它。请记住,自今年 1 月以来,Windows 7 已停止支持。

    关于shell - Chocolatey `Get-ExecutionPolicy` - 未捕获的 ReferenceError : Get is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62004709/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com