PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.71k stars 492 forks source link

"You have an older version of PackageManagement..." Prompts Repeatedly #2824

Closed sympmarc closed 4 years ago

sympmarc commented 4 years ago

System Details

System Details Output

### VSCode version: 1.47.2 17299e413d5590b14ab0340ea477cdd86ff13daf x64

### VSCode extensions:
blackmist.LinkCheckMD@0.3.1
DavidAnson.vscode-markdownlint@0.36.1
docsmsft.docs-article-templates@0.2.9
docsmsft.docs-authoring-pack@0.1.8   
docsmsft.docs-images@0.0.9
docsmsft.docs-linting@0.0.5
docsmsft.docs-markdown@0.2.76        
docsmsft.docs-metadata@1.0.4
docsmsft.docs-preview@0.3.53
docsmsft.docs-yaml@0.2.5
GitHub.vscode-pull-request-github@0.18.0
ms-vscode.powershell@2020.6.0
msjsdiag.debugger-for-chrome@4.12.9
redhat.vscode-yaml@0.9.1
streetsidesoftware.code-spell-checker@1.9.0

### PSES version: 2.2.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When I open a project, I am prompted with this probably 80% of the time. I've run it repeatedly, but it doesn't seem to make a difference.

image

If I click "Yes", this command is run"

PS D:\code\Denholtz\Deployment> powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber'

Expected Behaviour

One prompt makes sense if I'm out of date. But it simply repeats.

Actual Behaviour

Too many prompts.

kaiaschulz commented 4 years ago

Hi, I have exactly the same error as described above. Also a re-installation of "ms-vscode.PowerShell" wasn't successfull.

Message which will be displayed: You have an older version of PackageManagement known to cause issues with the PowerShell extension. Would you like to update PackageManagement (You will need to restart the PowerShell extension after)?

Command which will be executed if I click on "Yes": powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber'

Message which appears after the command was successfully executed: PackageManagement updated, If you already had PackageManagement loaded in your session, please restart the PowerShell extension.

Directly afterwards the initial message appears again. This only happens twice to me.


### VSCode version: 

Version: 1.47.2 (user setup)
Commit: 17299e413d5590b14ab0340ea477cdd86ff13daf

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

### VSCode extensions:

bencoleman.armview
ckolkman.vscode-postgres
donjayamanne.githistory
eamodio.gitlens
hashicorp.terraform
jmrog.vscode-nuget-package-manager
ms-dotnettools.vscode-dotnet-runtime
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode.powershell
ms-vsts.team
msazurermtools.azurerm-vscode-tools
GreatScott000 commented 4 years ago

I have been getting the same issue for about a month issue. When I run the update requested I get an error:

You have an older version of PackageManagement known to cause issues with the PowerShell extension. Would you like to update PackageManagement (You will need to restart the PowerShell extension after)?

PS E:\todd\Repos\Evolve-iMS\UNIT001_Apps> powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber' 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.6.0\PSModule.psm1:2057 char:21 ... $null = PackageManagement\Install-Package @PSBoundParameters


    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS E:\todd\Repos\Evolve-iMS\UNIT001\_Apps>get-psrepository

WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
WARNING: Unable to download the list of available providers. Check your internet connection.

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2/

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.14393
VSCode 1.47.3
PowerShell Extension Version 2020.6.0

PowerShell Information

Name Value
PSVersion 5.1.14393.3471
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.14393.3471
BuildVersion 10.0.14393.3471
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| |---|---|---| |al|ms-dynamics-smb|5.0.288712| |al-code-outline|andrzejzwierzchowski|2.0.5| |al-object-designer|martonsagi|0.2.2| |crs-al-language-extension|waldo|1.2.4| |gc-excelviewer|GrapeCity|3.0.39| |gitlens|eamodio|10.2.2| |navertical|Kine|0.5.6| |powershell|ms-vscode|2020.6.0| |team|ms-vsts|1.161.0| |todo-tree|Gruntfuggly|0.0.178| |vscode-guid|heaths|1.4.20| |vsliveshare|ms-vsliveshare|1.0.2478| |xml|DotJoshJohnson|2.5.1|
SydneyhSmith commented 4 years ago

What is the output of gmo PackageManagement -ListAvailable in the integrated console?

sympmarc commented 4 years ago

Before reinstalling PackageManagement:

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}

Command which runs:

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

After reinstalling PackageManagement:

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}

Before and after look the same to me...

rjmholt commented 4 years ago

@sympmarc does any error output appear in the integrated console?

sympmarc commented 4 years ago

No error at all. Just the prompt to reinstall PackageManager.

Since I posted the issue, I think I've figured out the pattern. The prompt comes up each time I open a new project folder, no matter how many other projects folders I have open in other VS Code windows. The prompt comes up right as the terminal window is revving up.

From that point forward in the project folder session, everything is fine.

If it's helpful, the prompt in the PowerShell Integrated Console is this:

=====> PowerShell Integrated Console v2020.6.0 <=====

PS D:\code\[...]> 

If I garbage can the terminal window for any reason, I'm prompted again.

rjmholt commented 4 years ago

Ok, given that, I think your logs might be useful here

sympmarc commented 4 years ago

Here are the logs from one PS terminal session. I can broaden out if that is useful.

1595969526-8689461e-d76d-4354-9e2a-0f05974d7ce41595969454260.zip

rjmholt commented 4 years ago

Strangely, there doesn't seem to be any report of failure:

2020-07-28 16:52:16.270 -04:00 [VRB] Attempting to execute command(s):

    powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber'
    Out-Default
sympmarc commented 4 years ago

It doesn't really feel like a failure, per se. It's more like the session doesn't see the installed version of PackageManager and thinks it needs a new install.

Here's a log with the reinstallation included. 1595970085-39394155-83d7-4431-b0d9-d0f1a64238f21595970040956.zip

SydneyhSmith commented 4 years ago

Thanks @sympmarc we actually just released an update to our Preview extension which has addressed a Package Management bug, would you mind giving it a try and letting us know if you are still hitting this issue?

kaiaschulz commented 4 years ago

Good morning, installed the linked preview.

Got now the "=====> PowerShell Preview Integrated Console v2020.7.0 <====="

Unfortunately, after the VSC was restarted I got the message "The 'PowerShell' extension is recommended for this file type." following by "You have an older version of PackageManagement known to cause issues with the PowerShell extension. Would you like to update PackageManagement (You will need to restart the PowerShell extension after)?"

If I click on "No" and press F5 for debugging my powershell code another message "Cannot debug or run a PowerShell script until the PowerShell session has started. Wait for the PowerShell session to finish starting and try again." appeared.

If I click on "Yes" the following code will be executed: powershell.exe -NoLogo -NoProfile -Command '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber -Repository PSGallery'

After the installation I got the message "PackageManagement updated, If you already had PackageManagement loaded in your session, please restart the PowerShell extension."

Now, the initial message "You have an older version of PackageManagement known to cause issues with the PowerShell extension. Would you like to update PackageManagement (You will need to restart the PowerShell extension after)?" popups again and I repeated it as described above.

sympmarc commented 4 years ago

I've installed the preview and disabled the older version. When I opened a new project, I'm still seeing the prompt and installing the extension and restarting the PowerShell extension lands me in the same place (as @kaiaschulz outlines above).

image

TylerLeonhardt commented 4 years ago

@sympmarc what happens when you hit "yes"

sympmarc commented 4 years ago

Sorry, I probably wasn't clear. If I install PackageManagement and restart the extension, I'm right back to the same place. In other words, this latest extension preview doesn't change anything. I have the same experience as @kaiaschulz.

TylerLeonhardt commented 4 years ago

What version of PackageManagement do you have?

sympmarc commented 4 years ago

Before reinstalling PackageManagement:

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}

Command which runs:

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

After reinstalling PackageManagement:

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}

Before and after look the same to me...

Same as above.

TylerLeonhardt commented 4 years ago

Have you tried manually running that command? Does anything happen?

sympmarc commented 4 years ago

Sorry for the lag. I just ran the command manually. PackageManagement is definitely installed, whether I run the command manually or by clicking 'Yes' in the prompt. It's the standard teal progress indicator you see when you install any module.

I just tried to run through this as administrator, in case it mattered, but no difference. (I'm pretty sure I'd tried that already.)

When I get the prompt to restart the PowerShell Extension, I'm just clicking the garbage can on the terminal session, which reloads it. Should I be doing something different? A restart of VS Code altogether doesn't solve it, either.

TylerLeonhardt commented 4 years ago

After it ran, what does:

gmo -list PackageManagement

give you?

TylerLeonhardt commented 4 years ago

You should have a 1.4.7 somewhere in the PSModulePath:

https://www.powershellgallery.com/packages/PackageManagement/1.4.7

rjmholt commented 4 years ago

I wonder if running it with -Verbose would shed any light. It seems very strange that the command runs, doesn't seem to fail, but does not install anything

sympmarc commented 4 years ago

The package version doesn't change. It's the same before and after updating.

image

The line it runs is this: powershell.exe -NoLogo -NoProfile -Command '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber -Repository PSGallery'

That's 1.4.6. For grins and giggles, I tried 1.4.7 - no difference.

Adding -Verbose: image

No idea why it would be installing to D:\OneDrive\Documents\WindowsPowerShell\Modules

rjmholt commented 4 years ago

Ok, next question: what is the result of $env:PSModulePath -split ';'?

rjmholt commented 4 years ago

No idea why it would be installing to D:\OneDrive\Documents\WindowsPowerShell\Modules

What's the result of [environment]::getfolderpath('mydocuments')?

sympmarc commented 4 years ago

image

rjmholt commented 4 years ago

As I suspected. PowerShellGet is using the special system folder API to guess the module install location, but PowerShell doesn't use that. Why I opened https://github.com/PowerShell/PowerShell/issues/7082.

I suspect the GetFolderPath() result is because OneDrive has frustratingly mangled your settings.

The way to solve this in your case is to Save-Module PackageManagement -MinimumVersion 1.4.7 -LiteralPath 'C:\Users\mdent\Documents\WindowsPowerShell\Modules\ (may need to massage that command a bit).

I would say this is a bug in PowerShellGet, but given that this feature is intended to move old systems (that aren't going to get a new version of either PSGet or PackageManagement without help) off of an old (and by old I mean like 5 years old) module version that deadlocks us just by being loaded, we may need to think of a better strategy. Honestly, just being able to permanently dismiss the notification would be helpful. Especially if work I'm currently doing can prevent the deadlock on our end...

rjmholt commented 4 years ago

Thanks for sticking with us btw @sympmarc!

sympmarc commented 4 years ago

That fixed it! Hey, no problem. We're all in this together. Than you for sticking with me!

kaiaschulz commented 4 years ago

Hey. I still have the same issue as before even if the package version was already on 1.4.7 and located in the mentioned path C:\Users\%username%\Documents\WindowsPowerShell\Modules above


[environment]::getfolderpath('mydocuments')

C:\Users\%username%\Documents

$env:PSModulePath -split ';'

C:\Users\%username%\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell
C:\Program Files (x86)\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell
C:\Program Files (x86)\AWS Tools\PowerShell\
C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell
c:\Users\%username%\.vscode\extensions\ms-vscode.powershell-preview-2020.7.0\modules 

In C:\Program Files (x86)\WindowsPowerShell\Modules and C:\Program Files\WindowsPowerShell\Modules was the old PackageManagement version 1.0.0.1

Regarding to this, I executed the mentioned command above for both pathes with administrative rights: Save-Module PackageManagement -MinimumVersion 1.4.7 -LiteralPath 'C:\Program Files\WindowsPowerShell\Modules' Save-Module PackageManagement -MinimumVersion 1.4.7 -LiteralPath 'C:\Program Files (x86)\WindowsPowerShell\Modules'

Afterwards the folders 1.4.7 were available.


Now, it seem to be fixed! Thanks a lot for all your help!

Nevertheless, why did the problem still persist even if the environment seem to be correctly set and the version was updated? [environment]::getfolderpath('mydocuments')

rjmholt commented 4 years ago

Nevertheless, why did the problem still persist even if the environment seem to be correctly set and the version was updated?

Your module path is different to the conventional default that PSGet expects — it seems strange that you have both x86 and normal module directories on the same module path; usually you only want either 32-bit or 64-bit locations on your module path.

My guess is that PSGet installed the module correctly to your 64-bit user path, but because the 32-bit path precedes it, you would always import the lower version out of preference. One way to fix that is to remove the lower versions of the module that appear when you run gmo -list PackageManagement

ThatNerdyPikachu commented 4 years ago

I have a different issue. It prompts repeatedly, but the version never updates.

gmo -list PackageManagement before prompt:

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...

Output in console when updating:

powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber'
WARNING: (0) : No source files specified

(1) : using System;

gmo -list PackageManagement after:

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...

What could be the cause of this?

rjmholt commented 4 years ago

Try opening a new powershell.exe console and running Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber -Verbose.

If you show us the full output of that, and if there's an error, $error[0] | fl * -force, we might have a better chance of debugging it.

ThatNerdyPikachu commented 4 years ago

Output of Install-Module:

WARNING: (0) : No source files specified
                                                                                                                        (1) : using System;                                                                                                     VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.       VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.                                        VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PackageManagement'' for
''.
VERBOSE: Total package yield:'2' for the specified package 'PackageManagement'.
VERBOSE: Performing the operation "Install-Module" on target "Version '1.4.7' of module 'PackageManagement'".
VERBOSE: The installation scope is specified to be 'CurrentUser'.
VERBOSE: The specified module will be installed in 'C:\Users\Pika\Documents\WindowsPowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'PackageManagement' with version '1.4.7' from the repository
'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PackageManagement'' for
''.
VERBOSE: InstallPackage' - name='PackageManagement',
version='1.4.7',destination='C:\Users\Pika\AppData\Local\Temp\1604792502'
VERBOSE: DownloadPackage' - name='PackageManagement',
version='1.4.7',destination='C:\Users\Pika\AppData\Local\Temp\1604792502\PackageManagement\PackageManagement.nupkg',
uri='https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.7'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.7'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.7'.
VERBOSE: Completed downloading 'PackageManagement'.
VERBOSE: Hash for package 'PackageManagement' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='PackageManagement',
version='1.4.7',destination='C:\Users\Pika\AppData\Local\Temp\1604792502'
VERBOSE: Catalog file 'PackageManagement.cat' is not found in the contents of the module 'PackageManagement' being
installed.
VERBOSE: Valid authenticode signature found in the file 'PackageManagement.psd1' for the module 'PackageManagement'.

I didn't see an error in this output, but I ran $error[0] | fl * -force anyways:

PSMessageDetails      :
Exception             : System.InvalidOperationException: Cannot add type. Compilation errors occurred.
                           at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord
                        errorRecord)
TargetObject          :
CategoryInfo          : InvalidData: (:) [Add-Type], InvalidOperationException
FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, C:\Program
                        Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1: line 732
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

Running gmo -list PackageManagement still shows 1.0.0.1

rjmholt commented 4 years ago

Looks like you're hitting an issue in PowerShellGet 1.0.0.1. Try updating PowerShellGet first: Install-Module PowerShellGet -AllowClobber -Scope CurrentUser -Force -Verbose. Then you'll need to open a new PowerShell process and try installing PackageManagement again

ThatNerdyPikachu commented 4 years ago

Nope, that didn't work. Version is still 1.0.0.1

rjmholt commented 4 years ago

Can you show the result of gmo -list PowerShellGet?

ThatNerdyPikachu commented 4 years ago
Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
rjmholt commented 4 years ago

Ok, I'm guessing you have a faulty PowerShellGet installation.

Try:

The let us know what gmo -list PowerShellGet outputs

ThatNerdyPikachu commented 4 years ago
Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
rjmholt commented 4 years ago

How about $env:PSModulePath

ThatNerdyPikachu commented 4 years ago
C:\Users\Pika\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
rjmholt commented 4 years ago

ls ~/Documents/WindowsPowerShell/Modules?

ThatNerdyPikachu commented 4 years ago

only directory there is PowerShellGet

rjmholt commented 4 years ago

Ok I'm assuming ~ maps to C:\Users\Pika -- does gi ~ | % FullName give you back C:\Users\Pika?

What does gmo -list PowerShellGet -Verbose look like?

Other thing to try is to take the downloaded, unzipped PowerShellGet and import it directly with ipmo -Force ~/Documents/WindowsPowerShell/Modules/PowerShellGet and confirm your version with gmo PowerShellGet

sympmarc commented 4 years ago

That fixed it! Hey, no problem. We're all in this together. Than you for sticking with me!

Unfortunately, while I thought this was "fixed" for me, it's still happening in some of my projects.

ThatNerdyPikachu commented 4 years ago

Ok I'm assuming ~ maps to C:\Users\Pika -- does gi ~ | % FullName give you back C:\Users\Pika?

Yes.

VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}

Why do you think this is happening?

rjmholt commented 4 years ago

Ok rather than me try to give you individual commands to run, which I don't think is working well and is taking time away from other issues, I think it's best for me to give some general directions.

I both cases here I think your machines have some state or configuration that goes against the assumptions of the PackageManagement/PowerShellGet installations that currently exist on them. Specifically in one case PackageManagement is failing for some reason and needs to be replaced, and in the other PowerShellGet's assumptions about the module path are wrong. So our goal is to put your machines into a state where PackageManagement/PowerShellGet are up to date, work and are available on the PSModulePath.

To fix this, you need to:

ThatNerdyPikachu commented 4 years ago

Thanks for the detailed instructions.

I get to the point where I run Install-Module, and this is the output:

VERBOSE: The installation scope is specified to be 'CurrentUser'.
VERBOSE: The specified module will be installed in 'C:\Users\Pika\Documents\WindowsPowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'PackageManagement' with version '1.4.7' from the repository
'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PackageManagement'' for
''.
VERBOSE: InstallPackage' - name='PackageManagement',
version='1.4.7',destination='C:\Users\Pika\AppData\Local\Temp\111535631'
VERBOSE: DownloadPackage' - name='PackageManagement',
version='1.4.7',destination='C:\Users\Pika\AppData\Local\Temp\111535631\PackageManagement\PackageManagement.nupkg',
uri='https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.7'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.7'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.7'.
VERBOSE: Completed downloading 'PackageManagement'.
VERBOSE: Hash for package 'PackageManagement' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='PackageManagement',
version='1.4.7',destination='C:\Users\Pika\AppData\Local\Temp\111535631'
VERBOSE: Catalog file 'PackageManagement.cat' is not found in the contents of the module 'PackageManagement' being
installed.
VERBOSE: Valid authenticode signature found in the file 'PackageManagement.psd1' for the module 'PackageManagement'.

C:\Users\Pika\Documents\WindowsPowerShell\Modules is empty in the end, though... I have permissions to create files and such in this folder...

What else could this be?

edit: same results if -Scope CurrentUser is specified as well...

rjmholt commented 4 years ago

I assume the currently imported versions of PowerShellGet and PackageManagement are the right ones? What does gmo PowerShellGet and gmo PackageManagement tell you?