PowerShellGetv2
PowerShellGetv2 copied to clipboard
Install-Module for PSReadLine 2.1.0 Beta 1 on PowerShell 7
When i try to install PSReadLine 2.1.0 Beta 1 on PowerShell 7 i get the following error:
This is the information:
Looks to me like you're using install-module
, so that would be for the v2 version of this module, the issues have been moved here:
https://github.com/PowerShell/PowerShellGetv2
That said, a guess would be that you're installing for the first time, so you haven't installed the nuget client binaries yet, which often requires admin rights.
And there is also no solution so getting nowhere only redirected from one place to the other.
@aavdberg I was waiting for a response to Justin's comment above. Are you running as admin?
Yes i am running as Admin, i solved the problem when i did see that Windows 10 Protected folders was blocking it.
So did this command in cmd with administrator rights.
But why powershell 7 gets blocked on Windows 10, where i have to report this and who will do something with it?
For that, please open an issue on the PowerShell repo.
Oh, that's a change in Windows that moves the user's Documents folder to OneDrive. That means the same issue will potentially happen to all modules that are ships with PowerShell, including PowerShellGet. @joeyaiello Can you please take a look here?
@daxian-dbw @joeyaiello have now the same with installing PowerShellGet
Install-Module -Name PowerShellGet -AllowPrerelease -Force
From @aavdberg:
But why powershell 7 gets blocked on Windows 10, where i have to report this and who will do something with it?
@SydneyhSmith For context, Windows moved the personal document folder to OneDrive, and it looks it blocks PowerShell from accessing the folders there, including the user module path folder (see https://github.com/PowerShell/PowerShellGetv2/issues/596#issuecomment-612780010). Can you please point @aavdberg to the right place to report this issue?
@aavdberg for the time being if you want a workaround you can update $env:PSModulePath to have the old documents folder prioritized on the path:
$env:PSModulePath = "<PreviousDocumentsPath>; $env:PSModulePath"
Thank you @alerickson just Friday received my new Surface Book 3 and was setting up everything. So I don't have a previous path.
But I can create a new location and copy all the content from the current location to this new location when I understand right?
@aavdberg, yup that'll work... the previous default documents path was:
C:\Users\<username>\Documents\PowerShell\Modules
I doubt if that will work for Install-Module
. If Install-Module
still treats the onedrive path as the personal module path, then it will not try to install modules to the newly created location.
Indeed not working and also when i remove the onedrive location from the env.
Ah okay, in that case as a workaround you can use Save-Module -Destination <PreferredPath>
This will install to the path specified.
I also ran into this exact problem and can confirm saving the module to another location and then copying it to the local module path worked. Hopefully this can be fixed soon as the problem is not obvious.