question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PackageManagement Module Update Problem

See original GitHub issue

Issue Description

When I start Powershell Extension, VSCode warns me about a conflict with the current version of PackageManagement module and recommend me to update it. When I run command :

powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber

It gives error :

WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2/'.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'PackageManagement'. Try Get-PSRepository to see all available
 registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

When I try to run the same command from my OS’s powershell console, it works as expected.

I use TLS1.2 as security protocol.

Kind regards

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 6.3.9600
VSCode 1.46.0
PowerShell Extension Version 2020.6.0

PowerShell Information

Name Value
PSVersion 5.1.14409.1018
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.14409.1018
BuildVersion 10.0.14409.1018
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
code-spell-checker streetsidesoftware 1.9.0
csharp ms-dotnettools 1.22.0
csharp2ts rafaelsalguero 0.0.24
debugger-for-chrome msjsdiag 4.12.8
githistory donjayamanne 0.6.5
mssql ms-mssql 1.9.0
powershell ms-vscode 2020.6.0
react-native-snippet jundat95 0.5.6
vscode-docker ms-azuretools 1.2.1
vscode-eslint dbaeumer 2.1.5
vscode-react-native msjsdiag 0.16.0
vscode-typescript-tslint-plugin ms-vscode 1.2.3
xml DotJoshJohnson 2.5.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
MSIHcommented, Oct 6, 2020

the powershell command to install the update should include the command to use TLS1.2

powershell.exe -NoLogo -NoProfile -Command '[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber
2reactions
nilsvbconxioncommented, Jun 18, 2020

Had a similar issue: updated to the new 2020.6 which caused a bunch of problems:

  • notification saying my packagement module was outdated and might cause problems, select yes to update => installed successfully, but couldn’t run any PowerShell
  • Everytime I restarted VSC it said the same, please update PackageManagement, PowerShell crashed.
  • Installed the dotnet version of PowerShell > terminal didn’t even start no more?? Exit code 1, An error message popped-up saying something of “> is resorved for later use” => crash
  • Tried several things, including reinstalling the PowerShell extension plugin, installing the 2020.6.1 preview (and disabling the stable 2020.6.0 one), reinstalled VSC, … Nothing seemed to work, and I couldn’t even get the menu to switch to another PowerShell version (“PowerShell takes longer to start than usual”). Went to the settings.json to change the directory to the dotnet core powershell, but didn’t work.

Eventually what saved me (at least for the moment it seems) was executing the command @MSIH wrote, but with 1 exception: changed -Scope CurrentUser to Allusers=> powershell.exe -NoLogo -NoProfile -Command '[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope AllUsers -AllowClobber -Verbose'

No more anoying popup about the Packagemanger. Also I could get back into the settings.json and added the following line: "powershell.powerShellDefaultVersion": "Windows PowerShell (x64)"

Finally I can work again 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to update PowerShellGet , error: The version '1.4.7' of ...
Powershell: Unable to update PowerShellGet , error: The version '1.4.7' of module 'PackageManagement' is currently in use · I try this command:
Read more >
Cannot install powershell modules - Microsoft Q&A
My problem is that I am not able to install modules to my powershell console. Example: Install-module -Name AzureAD. PS C:\WINDOWS\system32> ...
Read more >
Update PowerShellGet and PackageManagement
I wanted to share some information how you can update PowerShellGet and PackageManagement to the latest version. Check it out!
Read more >
PackageManagement\Install-Package : Unable to find repository
I was installing newest version of my PSWinDocumentation module on Windows 2016 when I noticed I can't really get anything to update.
Read more >
The case of potentially broken Package Management for ...
A couple of months ago though, I stumbled upon a curious issue where my PackageManagement module misbehaved after a fast ring update.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found