Error Installing Deno on Windows 11 using PowerShell 7.2 (and how I got it working)

I’ve been playing around with Deno lately and wanted to get it installed on a new Windows 11 laptop I bought. To install Deno, you can go to the page and follow the instruction for your operating system. I’m currently using Powershell 7.2 so I tried the command that was suggested since it’s normally a quick and easy install:

iwr -useb | iex

That led to the following error:

SetValueInvocationException: Exception setting "SecurityProtocol": "The requested security protocol is not supported."

After reading a few posts and an issue on Github the suggested fix looked to be the following. But, that didn’t work for me:

[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"

After scanning the Github issue more, I finally found a curl command that ended up working correctly with PowerShell. Problem solved (finally)!

curl.exe -fsSL | out-string | iex

Hopefully this helps someone else who gets stuck on the issue. If anyone knows why the SecurityProtocol command didn’t fix it, please leave a comment. I’d be interested in knowing how to get the iwr working correctly since that’s the default suggestion on the Deno installation page.

Join the free Code with Dan Development Newsletter!