javascript - vscode中Windows 10中的node.js安装错误
问题描述
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。有关这方面的更多信息,请参阅此博客文章。
以下内容直接取自该博客文章:
虽然您的操作系统可能支持 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
推荐阅读
- swift - SwiftUI 颜色的十六进制代码/RGB 值?
- r - 在 R 中聚合滞后
- python-3.x - Python GetActiveObject - Run Photoshop Action
- python - Error in finding linkeding profile using python linkedin-scraper 2.6.0
- bash - Redirect all messages to log file from inside script except some print command output on console as well as screen
- php - ACF 灵活内容 - 循环两个布局(解析错误?)
- javascript - async/await 语法有时似乎不起作用
- python - 套接字无法接收字节
- java - Shadow jar 缺少常见的 java 类
- javascript - 如何使用 vanilla JS 在滚动时平滑滚动到 div?