Chocolatey not Working with PowerShell cmdlets

Viewed 874

So, I got chocolatey up and running. But, I noticed that the cmdlets are not working. As in, if try to do anything using choco commands; ex: choco install vlc, it works just fine. However, if I try using good old cmdlets; ex: Install-Package -Name vlc -Source chocolatey, it keeps giving me angry warnings about not finding the chocolatey-core.extension.

The letteral message is:-

WARNING: NuGet: System.InvalidOperationException: Unable to find version '1.3.5.1' of package
'chocolatey-core.extension'.
WARNING: NuGet:    at NuGet.PackageRepositoryHelper.ResolvePackage(IPackageRepository sourceRepository,
IPackageRepository localRepository, IPackageConstraintProvider constraintProvider, String packageId,
SemanticVersion version, Boolean allowPrereleaseVersions)
WARNING: NuGet:    at NuGet.PackageManager.InstallPackage(String packageId, SemanticVersion version,
Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
WARNING: NuGet:    at NuGet.Commands.InstallCommand.InstallPackage(IFileSystem fileSystem, String
packageId, SemanticVersion version)
WARNING: NuGet:    at NuGet.Program.Main(String[] args)
WARNING: NuGet: System.InvalidOperationException: Unable to find version '3.0.11' of package 'vlc'.

I'm sorry if it is a bit trivial question, but I have tried to get it to work properly for quite some time now and it is really bugging me. I have followed the installation procedure on the chocolatey website, and I have unregistered then registered chocolatey as a package source. Also, If I try to update it, it says I am already running the latest version (both for the power shell and choco). Is this normal? Should I just forget about it?... In all seriousness though, what did I do wrong?

1 Answers

I have encountered this issue too. It seems to be a problem with NuGet and TLS 1.3. Although I'm unsure if the first set of commands were needed or not, running them all did overcome the issue.

Disable TLS 1.3

New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server' -Force | Out-Null

New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server' -name 'Enabled' -value '0' -PropertyType 'DWord' -Force | Out-Null

New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null

New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client' -Force | Out-Null

New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client' -name 'Enabled' -value '0' -PropertyType 'DWord' -Force | Out-Null

New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null

Change .Net Framework default TLS version

reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:64
reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:32

You may want to try the second set of commands first and if that does it alone I will update this answer.

Source

Related