Skip to content

PackageManagement Module Update Problem #2763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
serkanz opened this issue Jun 12, 2020 · 12 comments · Fixed by PowerShell/PowerShellEditorServices#1315
Closed

PackageManagement Module Update Problem #2763

serkanz opened this issue Jun 12, 2020 · 12 comments · Fixed by PowerShell/PowerShellEditorServices#1315
Labels
Area-Startup Issue-Bug A bug to squash. Up for Grabs Will shepherd PRs.

Comments

@serkanz
Copy link

serkanz commented Jun 12, 2020

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
@ghost ghost added the Needs: Triage Maintainer attention needed! label Jun 12, 2020
@cjpalmer
Copy link

This looks very much like the problem I had a few weeks ago. You can't download from the PSGallery because you aren't using TLS1.2. Try using the following before attempting your command:
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
That will force TLS1.2 (instead of the default 1.0 on some older systems)

@serkanz
Copy link
Author

serkanz commented Jun 16, 2020

This looks very much like the problem I had a few weeks ago. You can't download from the PSGallery because you aren't using TLS1.2. Try using the following before attempting your command:

That will force TLS1.2 (instead of the default 1.0 on some older systems)

I’m using TLS1.2, and it works when I run the command from powershell console. It doesn’t work when I’m in vscode. Even if I install the module via powershell console, when I open vscode, it tries to install again.

@MSIH
Copy link

MSIH commented Jun 16, 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

@wasker
Copy link

wasker commented Jun 16, 2020

I ran into the same issue after latest vscode-powershell update. The experience of the update is not great. Extension itself offers to perform an upgrade, but never completes that. No good guidance on how to deal with this manually is given too.

@SydneyhSmith
Copy link
Collaborator

Thanks everyone for commenting on this issue. We need to update our script to accommodate the changes to TLS--we arent working on this at the moment so if anyone would like to open a PR to make this change the change can be made here:
https://github.com/PowerShell/vscode-powershell/files/4770760/Logs.log

@pilgi3
Copy link

pilgi3 commented Jun 17, 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

This command did work for me! Great thank you! :)

@nilsvbconxion
Copy link

nilsvbconxion commented 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 :-)

@bricenocar
Copy link

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

Worked perfect :), thanks!

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Oct 6, 2020
@rjmholt rjmholt removed the Needs: Maintainer Attention Maintainer attention needed! label Oct 6, 2020
@darthstark1138
Copy link

Still happening, none of the solutions worked for me. I always get "The version '1.4.7' of module 'PackageManagement' is currently in use."

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Oct 20, 2020
@corbob
Copy link
Contributor

corbob commented Oct 20, 2020

Still happening, none of the solutions worked for me. I always get "The version '1.4.7' of module 'PackageManagement' is currently in use."

@mvhecht are you running the preview extension? I believe this is fixed in that extension.

@shvlzz
Copy link

shvlzz commented Oct 23, 2020

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'

Originally posted by @nilsvbconxion in #2763 (comment)

This worked for me, but had to run VS Code as Administrator first and then run the above command.
The update is applied to All Users (as the command suggests).

Still happening, none of the solutions worked for me. I always get "The version '1.4.7' of module 'PackageManagement' is currently in use."

Originally posted by @mvhecht in #2763 (comment)

Try running VS Code as Administrator.

@melrose24
Copy link

Man, I have been having this update issues for months. Glad I stumbled across this. powershell.exe -NoLogo -NoProfile -Command '[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope AllUsers -AllowClobber -Verbose' Was the one that worked for me in the end.

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Startup Issue-Bug A bug to squash. Up for Grabs Will shepherd PRs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.