PowerShell / PowerShellGetv2

PowerShellGet is the Package Manager for PowerShell
https://www.PowerShellGallery.com
MIT License
430 stars 138 forks source link

No match was found for provider Nuget on initial installation attempt #664

Open ruffin-- opened 2 years ago

ruffin-- commented 2 years ago

Goal

Attempting to follow installation instructions from here:

Note: For PowerShell version 5.1.14393.206 or newer, before installing PSScriptAnalyzer, please install the latest Nuget provider by running the following in an elevated PowerShell session.

Install-PackageProvider Nuget -MinimumVersion 2.8.5.201 –Force
Exit

Steps to reproduce

  1. Hit Windows Key.
  2. Type pwsh
  3. Mouse to right and select "Run as adminstrator"
  4. Select "Yes" for User Access Control
  5. Paste commands from instructions.
PowerShell 7.2.0
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS C:\Windows\System32> Install-PackageProvider Nuget -MinimumVersion 2.8.5.201 –Force
Install-PackageProvider: No match was found for the specified search criteria for the provider 'Nuget'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
PS C:\Windows\System32>

Expected behavior

Nuget is installed successfully.

Actual behavior

Error as shown above and repeated here:

Install-PackageProvider: No match was found for the specified search criteria for the provider 'Nuget'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.

If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *

PS C:\Windows\System32> $error[0] | Select-Object *

PSMessageDetails      :
Exception             : System.Exception: No match was found for the specified search criteria for the provider
                        'Nuget'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check
                        if the specified package has the tags.
TargetObject          : Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
CategoryInfo          : InvalidArgument: (Microsoft.PowerShel…tallPackageProvider:InstallPackageProvider)
                        [Install-PackageProvider], Exception
FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}

Environment data

PS C:\Windows\System32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

(Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }

PS C:\Windows\System32> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
InvalidOperation: You cannot call a method on a null-valued expression.
StevenBucher98 commented 2 years ago

Hi @ruffin-- can you try manually installing PackageManagement and PowerShellGet following these steps outlined here: https://github.com/PowerShell/PowerShellGet/issues/488#issuecomment-926102857

We will be investigating further in hope to have a more clarified fix of instructions.