pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
655 stars 337 forks source link

"Install-Module PnP.PowerShell" does not working and get an error. #38

Closed maciejkukulka closed 3 years ago

maciejkukulka commented 3 years ago

Notice

PS C:\Windows\System32> Install-Module PnP.PowerShell
Install-Package: C:\powershell-7.1.0-win-x64\Modules\PowerShellGet\PSModule.psm1:9711
Line |
9711 |  … talledPackages = PackageManagement\Install-Package @PSBoundParameters
     |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No match was found for the specified search criteria and module name 'PnP.PowerShell'. Try
     | Get-PSRepository to see all available registered module repositories.

Reporting an Issue or Missing Feature

Reporting Issue

Expected behavior

Want to install module PnP.PowerShell

Actual behavior

Getting an error like the one above.

Steps to reproduce behavior

Just Install-Module PnP.PowerShell

What is the version of the Cmdlet module you are running?

PS C:\Windows\System32> Get-Module -Name sharepointpnppowershell* -ListAvailable

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Binary     3.26.2010…            SharePointPnPPowerShellOnline       Desk      {Add-PnPAlert, Add-PnPApp, Add-PnPAppli…
Binary     3.25.2009…            SharePointPnPPowerShellOnline       Desk      {Add-PnPAlert, Add-PnPApp, Add-PnPAppli…
diver7 commented 3 years ago

@maciejkukulka What version of Powershell are you using? You need to be on PS version 7.0 or above so that it is using the cross platform version of the powershell core.

maciejkukulka commented 3 years ago

I downloaded the new version (7.1) because on version 5.1 I had the same errors.

maciejkukulka commented 3 years ago

When trying to use Visual Studio Code terminal i get an error like this:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\maciej.kukulka\Desktop> Install-Module PnP.PowerShell -AllowPrerelease
Install-Module : A parameter cannot be found that matches parameter name 'AllowPrerelease'.
At line:1 char:31
+ Install-Module PnP.PowerShell -AllowPrerelease
+                               ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Install-Module

PS C:\Users\maciej.kukulka\Desktop> Install-Module PnP.PowerShell                 
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'PnP.PowerShell'. Try Get-PSRepository to see all available
 registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS C:\Users\maciej.kukulka\Desktop>
maciejkukulka commented 3 years ago

I downloaded PS 7.1 on virtual machine and it works correctly. 2020-12-02 09_06_25-wirtualną Do I need to change some permissions on my PC?

maciejkukulka commented 3 years ago

OK, got it. I had to install PowerShellGet to make it working properly. Install-Module -Name PowerShellGet -Force