2

I'm having trouble installing and configuring Leiningen on a Windows 10 work computer. I'm assuming that my company's firewall prevents the GitHub security certificate from authenticating.

The error I'm getting is:

Exception calling "DownloadFile" with "2" argument(s): "The request was aborted: Could not create SSL/TLS secure channel." At line:1 char:145 + ... che]::DefaultNetworkCredentials; $client.DownloadFile($a, $f)} "https ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : WebException

Failed to download https://github.com/technomancy/leiningen/releases/download/2.8.1/leiningen-2.8.1-standalone.zip

It is possible that the download failed due to "powershell", "curl" or "wget"'s inability to retrieve GitHub's security certificate. The suggestions below do not check certificates, so use this only if you understand the security implications of not doing so.

The PowerShell failed to download the latest Leiningen version. Try to use "curl" or "wget" to download Leiningen by setting up the HTTP_CLIENT environment variable with one of the following values:

  • set HTTP_CLIENT=wget --no-check-certificate -O
  • set HTTP_CLIENT=curl -f -L -k -o

NOTE: Make sure to not add double quotes when setting the value of HTTP_CLIENT

2 Answers 2

5

Github only supports TSL 1.2. By default PowerShell doesn't support this protocol.

To add TSL 1.2 support to every PowerShell session you need to edit your PowerShell profile: Microsoft.PowerShell_profile.ps1.

Path to profile (Windows 10):

C:\Users\%USERNAME%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

Add this line to profile:

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12

After you add this line, try again with "lein self-install". At least this worked for me, remember to add PATH Variable.

Quick tutorial on how to add PATH variable:

  1. Open up File Explorer
  2. Right-click on This PC
  3. Select Properties
  4. On the left hand side of the new window select Advanced System Settings
  5. On the bottom of this screen select Environment Variables…
  6. Find the PATH variable
  7. Append ;C\Lein\; (path to folder where is your lein.bat) to the existing PATH variable

If everything worked you should have similar answer:

CMD working lein

1
1

I had the same problem.

If you have curl installed use the command it give you there:

set HTTP_CLIENT=curl -f -L -k -o

This worked for me.

2
  • The trick is to use cmd when executing this line. When in Powershell, type cmd to use this line. Then type powershell to go back again. Then lein self-install or whatever. Jun 22, 2018 at 6:14
  • Would this solution be considered a security risk?
    – ElMatador
    Oct 27, 2018 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.