posh-git
posh-git copied to clipboard
Installation fails
System Details
- posh-git version/path: n/a
- PowerShell version: 7.1.2
- Git version: git version 2.24.1.windows.2
- Operating system name and version: Windows 10 Pro Build 19042.804
Issue Description
I am experiencing a problem with the installation of posh-git when running the command PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force
I get the following error:
Install-Package: C:\program files\windowsapps\microsoft.powershell_7.1.2.0_x64__8wekyb3d8bbwe\Modules\PowerShellGet\PSModule.psm1:9711 Line | 9711 | … talledPackages = PackageManagement\Install-Package @PSBoundParameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Administrator rights are required to install or update. Log on to the computer with an account that | has Administrator rights, and then try again, or install by adding "-Scope CurrentUser" to your | command. You can also try running the Windows PowerShell session with elevated rights (Run as | Administrator).
Running as administrator did not fix the problem
See if https://github.com/PowerShell/PowerShell/issues/12777 helps any. BTW do have a previous version of posh-git installed or is this a first time install? Also see https://github.com/PowerShell/PowerShellGetv2/issues/586#issuecomment-781282650
I had this problem too. I was trying to update from 1.0.0-beta4 to 1.0.0 but update-module
didn't seem to do anything. I tried uninstall-module
which also didn't seem to do anything. So I deleted the posh-git
folder from my module directory and tried to install fresh, which is when I got the error message above.
Finding this, I was able to work around it this time by running save-module posh-git -path C:\Temp
and then copying the posh-git
folder from C:\Temp
to my module path.
I do have a customized module path, which may or may not have had something to do with it. However, I was able to install 1.0.0-beta4 just fine last year, so idk.
- PowerShell version: 7.1.2
- Git version: 2.29.2.windows.2
- OS: Windows 10 Pro for Workstations 18363.1379
I can't reproduce this. Are you able to get the same error installing a module other than posh-git?
I didn't get an error when I tried uninstalling and then installing the DirColors module, for example. I don't install PowerShell modules very often so I don't know what all I ought to try.
I don't think this error is specific to posh-git but I'm not sure why it would appear for some modules and not others.
I commented earlier mostly just to share the save-module
workaround.
At first I had this same error.
Then I tried just removing the flag and the installation seemed to work find.
Then I read a bit more, and found this discussion which seemed to suggest there is two prerequisites (at least for Windows) to using the -AllowPrerelease flag:
Install-Module -Name PackageManagement -Repository PSGallery -Force
Install-Module -Name PowerShellGet -Repository PSGallery -Force
# Then restart/open a new (elevated?) shell and run:
PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force
I then re-ran the install command (vs the update comment). TBD whether I'll run into issues. I suppose I'll try an uninstall + reinstall if so.
Thanks for this tool, @dahlbyk!
Hmm, I need to update the README. The -AllowPrerelease
parameter does not apply to v1 now that it is no longer prerelease. :-)
Can someone with necessary access correct the title, please? (Typo: double 'a')
Verbose output:
Install-Module posh-git -Scope CurrentUser -Force -Verbose
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.powershellgallery.com/api/v2/FindPackagesById()?id='posh-git'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'posh-git'.
VERBOSE: Performing the operation "Install-Module" on target "Version '1.0.0' of module 'posh-git'".
VERBOSE: The installation scope is specified to be 'CurrentUser'.
VERBOSE: The specified module will be installed in 'C:\Users\movgp\Documents\PowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'posh-git' with version '1.0.0' from the repository 'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='posh-git'' for ''.
VERBOSE: InstallPackage' - name='posh-git', version='1.0.0',destination='C:\Users\movgp\AppData\Local\Temp\1308997091'
VERBOSE: DownloadPackage' - name='posh-git', version='1.0.0',destination='C:\Users\movgp\AppData\Local\Temp\1308997091\posh-git.1.0.0\posh-git.1.0.0.nupkg', uri='https://www.powershellgallery.com/api/v2/package/posh-git/1.0.0'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/posh-git/1.0.0'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/posh-git/1.0.0'.
VERBOSE: Completed downloading 'posh-git'.
VERBOSE: InstallPackageLocal' - name='posh-git', version='1.0.0',destination='C:\Users\movgp\AppData\Local\Temp\1308997091'
VERBOSE: Validating the 'posh-git' module contents under 'C:\Users\movgp\AppData\Local\Temp\1308997091\posh-git.1.0.0' path.
VERBOSE: Test-ModuleManifest successfully validated the module manifest file 'C:\Users\movgp\AppData\Local\Temp\1308997091\posh-git.1.0.0'.
VERBOSE: Validating the authenticode signature and publisher of the catalog file or module manifest file of the module 'posh-git'.
VERBOSE: Catalog file 'posh-git.cat' is not found in the contents of the module 'posh-git' being installed.
VERBOSE: Checking for possible command collisions for the module 'posh-git' commands.
Install-Package: C:\program files\windowsapps\microsoft.powershell_7.1.3.0_x64__8wekyb3d8bbwe\Modules\PowerShellGet\PSModule.psm1:9711
Line |
9711 | … talledPackages = PackageManagement\Install-Package @PSBoundParameters
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Administrator rights are required to install or update. Log on to the computer with an account that has Administrator rights, and then try
| again, or install by adding "-Scope CurrentUser" to your command. You can also try running the Windows PowerShell session with elevated
| rights (Run as Administrator).
System Version
Platform : Win32NT
ServicePack :
Version : 10.0.22000.0
VersionString : Microsoft Windows NT 10.0.22000.0
PS Version
Major Minor Build Revision
----- ----- ----- --------
7 1 3 -1
There are "issues" with Install-Module. Fortunately the PowerShell team is working on a new & improved way to install modules via PowerShellGet v3. For now, exit all instances of pwsh.exe and then delete the posh-git
folder under C:\Users\movgp\Documents\PowerShell\Modules
(if one exists). And try to install again. If that doesn't work, look at this issue on the PowerShell repo and try the work-arounds listed there.
Is this still an issue for anyone with the current 1.1.0 release?