Skip to content
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

Install-Package: No match was found for the specified search criteria and package name #360

Closed
thnk2wn opened this issue May 22, 2018 · 6 comments

Comments

@thnk2wn
Copy link

thnk2wn commented May 22, 2018

I'm unable to use Install-Package for a valid Nuget package (MetadataExtractor) using PS 6.0.2 on Mac. Am I doing something wrong?

screenshot

Install-Package with Version and Destination

PS /Users/hudgeo> Install-Package MetadataExtractor -Version 2.0.0 -Destination /Users/hudgeo/Scripts                  
Install-Package : A parameter cannot be found that matches parameter name 'Version'.
At line:1 char:35
+ Install-Package MetadataExtractor -Version 2.0.0 -Destination /Users/ ...
+                                   ~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Install-Package], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Install-Package with Version:

PS /Users/hudgeo> Install-Package MetadataExtractor -Version 2.0.0                                                     
Install-Package : A parameter cannot be found that matches parameter name 'Version'.
At line:1 char:35
+ Install-Package MetadataExtractor -Version 2.0.0
+                                   ~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Install-Package], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Install-Package no version or destination with Verbose:

PS /Users/hudgeo> install-package MetadataExtractor -verbose                                                           
VERBOSE: Using the provider 'NuGet' for searching packages.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: Searching repository 'https://api.nuget.org/v3/index.json/FindPackagesById()?id='MetadataExtractor'' for ''.
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='MetadataExtractor'' for ''.
VERBOSE: Total package yield:'0' for the specified package 'MetadataExtractor'.
install-package : No match was found for the specified search criteria and package name 'MetadataExtractor'. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ install-package MetadataExtractor -verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Install-Package using ProviderName NuGet and Destination

PS /Users/hudgeo> Install-Package MetadataExtractor -ProviderName Nuget -Destination /Users/hudgeo/Scripts                                                                                                                                    
Install-Package : No match was found for the specified search criteria and package name 'MetadataExtractor'. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Install-Package MetadataExtractor -ProviderName Nuget -Destination /U ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS Version:

PS /Users/hudgeo> $PSVersionTable                                                                                                                                                                                                             
Name                           Value                                                                                  
----                           -----                                                                                  
PSVersion                      6.0.2                                                                                  
PSEdition                      Core                                                                                   
GitCommitId                    v6.0.2                                                                                 
OS                             Darwin 17.5.0 Darwin Kernel Version 17.5.0: Fri Apr 13 19:32:32 PDT 2018; root:xnu-4...
Platform                       Unix                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                
PSRemotingProtocolVersion      2.3                                                                                    
SerializationVersion           1.1.0.1                                                                                
WSManStackVersion              3.0   
@bmanikm
Copy link
Contributor

bmanikm commented May 22, 2018

@thnk2wn
Support for NuGet v3 sources got added in 1.2.0-preview version of the PackageManagement module, take a look at the release notes for more details.

You can install this preview version using Install-Module command.

Install-Module PackageManagement -Force -Repository PSGallery -AllowPrerelease
# Launch a new PS session

@thnk2wn
Copy link
Author

thnk2wn commented May 23, 2018

Thanks @bmanikm. It also seems adding "-AllowPrerelease" is required for this.

However after installing and starting a new PS session, installing the package just results in execution hanging indefinitely:

hang

@thnk2wn
Copy link
Author

thnk2wn commented May 23, 2018

@bmanikm After quite some time it eventually came back with an error:

Install-Package : Unable to find dependent package(s) (System.Reflection.Emit.Lightweight)
At line:1 char:1
+ Install-Package MetadataExtractor
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (System.Reflection.Emit.Lightweight:String) [Install-Package], Exception
+ FullyQualifiedErrorId : UnableToFindDependencyPackage,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

@turbolego
Copy link

turbolego commented May 29, 2018

@bmanikm -AllowPreRelease does not work for me?

Install-Module PackageManagement -Force -Repository PSGallery -AllowPrerelease
Install-Module : A parameter cannot be found that matches parameter name 'AllowPrerelease'.
At line:1 char:63
+ ... odule PackageManagement -Force -Repository PSGallery -AllowPrerelease
+                                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Install-Module

EDIT:

This is what fixed this issue for me:

Register-PackageSource -Name nuget.org -Location https://www.nuget.org/api/v2 -ProviderName NuGet

Log:

PS C:\WINDOWS\system32> Register-PackageSource -Name nuget.org -Location https://www.nuget.org/api/v2 -ProviderName NuGet

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
nuget.org                        NuGet            False      https://www.nuget.org/api/v2

PS C:\WINDOWS\system32> Install-Package Microsoft.Azure.IoTHub.IoTHubClient -Verbose
VERBOSE: Using the provider 'NuGet' for searching packages.
VERBOSE: Using the provider 'msi' for searching packages.
VERBOSE: Using the provider 'Programs' for searching packages.
VERBOSE: Using the provider 'msu' for searching packages.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
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.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Azure.IoTHub.IoTHubClient'' for ''.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Microsoft.Azure.IoTHub.IoTHubClient'' for ''.
VERBOSE: Total package yield:'0' for the specified package 'Microsoft.Azure.IoTHub.IoTHubClient'.
VERBOSE: Total package yield:'1' for the specified package 'Microsoft.Azure.IoTHub.IoTHubClient'.
VERBOSE: Performing the operation "Install Package" on target "Package 'Microsoft.Azure.IoTHub.IoTHubClient' version '1.2.4' from 'nuget.org'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Azure.IoTHub.IoTHubClient'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Azure.C.SharedUtility'' for ''.
VERBOSE: InstallPackage' - name='Microsoft.Azure.C.SharedUtility', version='1.1.4',destination='C:\Program Files\PackageManagement\NuGet\Packages'
VERBOSE: DownloadPackage' - name='Microsoft.Azure.C.SharedUtility', version='1.1.4',destination='C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.Azure.C.SharedUtility.1.1.4\Microsoft.Azure.C.SharedUtility.1.1.4.nupkg',
uri='https://www.nuget.org/api/v2/package/Microsoft.Azure.C.SharedUtility/1.1.4'
VERBOSE: Downloading 'https://www.nuget.org/api/v2/package/Microsoft.Azure.C.SharedUtility/1.1.4'.
VERBOSE: Completed downloading 'https://www.nuget.org/api/v2/package/Microsoft.Azure.C.SharedUtility/1.1.4'.
VERBOSE: Completed downloading 'Microsoft.Azure.C.SharedUtility'.
VERBOSE: Hash for package 'Microsoft.Azure.C.SharedUtility' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='Microsoft.Azure.C.SharedUtility', version='1.1.4',destination='C:\Program Files\PackageManagement\NuGet\Packages'
VERBOSE: InstallPackage' - name='Microsoft.Azure.IoTHub.IoTHubClient', version='1.2.4',destination='C:\Program Files\PackageManagement\NuGet\Packages'
VERBOSE: DownloadPackage' - name='Microsoft.Azure.IoTHub.IoTHubClient', version='1.2.4',destination='C:\Program
Files\PackageManagement\NuGet\Packages\Microsoft.Azure.IoTHub.IoTHubClient.1.2.4\Microsoft.Azure.IoTHub.IoTHubClient.1.2.4.nupkg', uri='https://www.nuget.org/api/v2/package/Microsoft.Azure.IoTHub.IoTHubClient/1.2.4'
VERBOSE: Downloading 'https://www.nuget.org/api/v2/package/Microsoft.Azure.IoTHub.IoTHubClient/1.2.4'.
VERBOSE: Completed downloading 'https://www.nuget.org/api/v2/package/Microsoft.Azure.IoTHub.IoTHubClient/1.2.4'.
VERBOSE: Completed downloading 'Microsoft.Azure.IoTHub.IoTHubClient'.
VERBOSE: Hash for package 'Microsoft.Azure.IoTHub.IoTHubClient' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='Microsoft.Azure.IoTHub.IoTHubClient', version='1.2.4',destination='C:\Program Files\PackageManagement\NuGet\Packages'

Name                           Version          Source           Summary
----                           -------          ------           -------
Microsoft.Azure.C.SharedUti... 1.1.4            nuget.org        This nuget package can be used to develop applications and libraries
Microsoft.Azure.IoTHub.IoTH... 1.2.4            nuget.org        This nuget package contains common interface shared between AMQP, MQTT and HTTP transports to IoTHub

@bmanikm
Copy link
Contributor

bmanikm commented May 29, 2018

@thnk2wn It looks like all the versions of System.Reflection.Emit.Lightweight and System.Reflection.Emit packages got unlisted on NuGet.org. This is a duplicate of #322.

@turbolego Prerelease versioning support was enabled in 1.6.0 version of the PowerShellGet module. To install the prerelease versions of a module, you need to install the latest version of PowerShellGet first using the instructions provided here

@turbolego
Copy link

Thank you @bmanikm !

Worked for me:

PS C:\WINDOWS\system32> Update-Module -Name PowerShellGet
PS C:\WINDOWS\system32> Install-Module PackageManagement -Force -Repository PSGallery -AllowPrerelease
PS C:\WINDOWS\system32> Install-Package Microsoft.Azure.IoTHub.IoTHubClient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants