![](/img/trans.png)
[英]I am facing a certificate error while trying to install NPM packages on Windows. I am using Node v10.9.0
[英]Error while trying to install Node, and its related programs, and apparently because I can't get TLS 1.2 support in Windows 7
我尝试安装 Node,以及它可选“需要”的任何额外工具,其中显然包括“Chocolatey”。
("Chocolatey" is a poorly named package manager. The developer of it saw that Visual Studio IDE has NuGet, he thought it'd be good if Windows had a package manager, just as unix-based OSs have package managers like debian has apt -get 或 osx 有 brew 和 macports,他为 windows 制作了一个叫做“巧克力”的笑话,它支持的软件数量越来越多。例如,我看到你可以做choco install vlc
来安装 VLC 媒体播放器。我不知道 Node 会使用它来安装什么软件,但无论如何)
我尝试安装 Node,我想我勾选了它以安装它需要的其他软件。 它要求我关闭所有程序,我确实这样做了。
我在安装过程中收到此错误
我搜索了那个错误“用“1”调用“DownloadString”的异常”
我得到了这个https://chocolatey.org/docs/troubleshooting
“如果您看到以下内容:使用“1”参数调用“DownloadString”的异常:“请求被中止:无法创建 SSL/TLS 安全通道。”那么您可能正在运行需要升级的旧机器至少能够使用 TLS 1.2。”
我觉得这很奇怪,因为 TLS 1.2 很久以前就发布了,如本页所示。 https://kinsta.com/knowledgebase/tls-vs-ssl/ TLS 1.2 was released in 2008. I'd be surprised if Windows 7 doesn't support it, since Windows 7 only reached end of life Jan 2020. Even TLS 1.3 于 2018 年发布。
搜索错误时,我发现这个页面https://support.cybersource.com/s/article/How-do-I-enable-TLS-1-2-on-Windows-7
它提到了它说我需要的某些注册表项。
根据https://chocolatey.org/blog/remove-support-for-old-tls-versions
While your operating system may support TLS 1.2 it's important to remember that it may have to be enabled. If you are working from
PowerShell 您可以通过运行以下代码了解您的系统支持哪些协议:
[Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12' Copy If the result is True then your system supports TLS 1.2.
然后它继续说是否支持如何检查它是否正在使用。
但对我来说
TLS 1.2 显示为不受支持
PS C:\Users\User> [Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12'
False
我看到了这个页面https://support.cybersource.com/s/article/How-do-I-enable-TLS-1-2-on-Windows-7
并制作了这个 reg 文件
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"DisabledByDefault"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"DisabledByDefault"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"DisabledByDefault"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"DisabledByDefault"=dword:00000000
我注意到我有一个密钥(左侧的文件夹),在名为 SSL 2.0 的 regedit 中不知道应该在那里
我尝试重新启动但仍然运行提到的 powershell 命令给出错误,表明不支持 TLS 1.2。
您需要将这些值添加到您的注册键中:
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
它们取自Sanjeev Kumar在node.js installation error in windows 10 in vscode 中的回答 ... 并为我工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.