vscode 中 Windows 10 中的 Node.js 安装错误

2023-12-24

Exception calling "DownloadString" with "1" argument(s): "The request was aborted: Could not create SSL/TLS secure
channel."
At line:1 char:1
+ iex ((New-Object System.Net.WebClient).DownloadString('https://chocol ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException
choco : The term 'choco' 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:95
+ ... .DownloadString('https://chocolatey.org/install.ps1')); choco upgrade ...
+                                                             ~~~~~
    + CategoryInfo          : ObjectNotFound: (choco:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException*

您正在尝试在未启用 TLS 1.2 的情况下安装 Chocolatey。看这篇博文 https://chocolatey.org/blog/remove-support-for-old-tls-versions了解更多相关信息。

以下内容直接摘自该博客文章:

虽然您的操作系统可能支持 TLS 1.2,但请务必记住它可能必须启用。如果您使用 PowerShell,您可以通过运行以下代码来了解您的系统支持哪些协议:

[Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12'

如果结果为 True,则您的系统支持 TLS 1.2。您可以通过运行以下命令来了解正在使用哪些协议:

[System.Net.ServicePointManager]::SecurityProtocol.HasFlag([Net.SecurityProtocolType]::Tls12)

如果结果为 True,则正在使用 TLS 1.2。但是,您可以使用以下方法显式添加 TLS 1.2:

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

vscode 中 Windows 10 中的 Node.js 安装错误 的相关文章

随机推荐