PowerShellGetv2 icon indicating copy to clipboard operation
PowerShellGetv2 copied to clipboard

Install-Module for PSReadLine 2.1.0 Beta 1 on PowerShell 7

Open aavdberg opened this issue 4 years ago • 17 comments

When i try to install PSReadLine 2.1.0 Beta 1 on PowerShell 7 i get the following error:

image

This is the information:

image

aavdberg avatar Apr 07 '20 17:04 aavdberg

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.

JustinGrote avatar Apr 07 '20 19:04 JustinGrote

And there is also no solution so getting nowhere only redirected from one place to the other.

aavdberg avatar Apr 11 '20 08:04 aavdberg

@aavdberg I was waiting for a response to Justin's comment above. Are you running as admin?

alerickson avatar Apr 13 '20 02:04 alerickson

Yes i am running as Admin, i solved the problem when i did see that Windows 10 Protected folders was blocking it.

image

image

aavdberg avatar Apr 13 '20 07:04 aavdberg

So did this command in cmd with administrator rights.

image

aavdberg avatar Apr 13 '20 07:04 aavdberg

But why powershell 7 gets blocked on Windows 10, where i have to report this and who will do something with it?

aavdberg avatar Apr 13 '20 07:04 aavdberg

For that, please open an issue on the PowerShell repo.

alerickson avatar Apr 13 '20 16:04 alerickson

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 avatar Apr 21 '20 00:04 daxian-dbw

@daxian-dbw @joeyaiello have now the same with installing PowerShellGet

Install-Module -Name PowerShellGet -AllowPrerelease -Force image

aavdberg avatar Jun 08 '20 20:06 aavdberg

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?

daxian-dbw avatar Jun 08 '20 20:06 daxian-dbw

@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"

alerickson avatar Jun 08 '20 21:06 alerickson

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 avatar Jun 08 '20 21:06 aavdberg

@aavdberg, yup that'll work... the previous default documents path was: C:\Users\<username>\Documents\PowerShell\Modules

alerickson avatar Jun 08 '20 22:06 alerickson

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.

daxian-dbw avatar Jun 08 '20 22:06 daxian-dbw

Indeed not working and also when i remove the onedrive location from the env.

aavdberg avatar Jun 08 '20 22:06 aavdberg

Ah okay, in that case as a workaround you can use Save-Module -Destination <PreferredPath> This will install to the path specified.

alerickson avatar Jun 08 '20 22:06 alerickson

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.

cygnim avatar Jul 17 '20 20:07 cygnim