InstallModuleFromGitHub icon indicating copy to clipboard operation
InstallModuleFromGitHub copied to clipboard

Errors on Windows

Open AussieWoji opened this issue 2 years ago • 3 comments

This worked great on Mac but I encountered errors on Windows. It errors on the Get-Childitem and then the Copy-Item towards the end of the process. Both are contained in an if statement to check the operating system. In testing, it appears these if statements are not necessary. When I stepped through and used the UNIX versions for each of the Get-ChildItem and Copy-Item commands they worked as expected.

AussieWoji avatar Nov 18 '22 02:11 AussieWoji

It does look like there is a pull request ready to be merged with the fix for this.

AussieWoji avatar Nov 18 '22 02:11 AussieWoji

Please post more detail on both the issue and PR

dfinke avatar Nov 18 '22 15:11 dfinke

Get-ChildItem: Cannot find path 'C:\Users\paul\AppData\Local\Temp\4597321876E46F17A031B679ABE80F5DCDA0BD350BCF27485383801C570FF7D0\C:\Users\paul\AppData\Local\Temp\4597321876E46F17A031B679ABE80F5DCDA0BD350BCF27485383801C570FF7D0\AussieWoji-Wojis.IT.TeamTools-2fe45c27e070ccf647bcba28000584044863a773'
because it does not exist. Copy-Item: Cannot find path'C:\Users\paul\AppData\Local\Temp\4597321876E46F17A031B679ABE80F5DCDA0BD350BCF27485383801C570FF7D0\C:\Users\paul\AppData\Local\Temp\4597321876E46F17A031B679ABE80F5DCDA0BD350BCF27485383801C570FF7D0\AussieWoji-Wojis.IT.TeamTools-2fe45c27e070ccf647bcba28000584044863a773'
because it does not exist.

The path is wrong because the if statements are using a Join-Path to put two paths together that do not work. You cannot have two C: in a valid path. I found that if you just remove the If statements it works fine. Probably because you have already decided if the path is Unix or Windows earlier in the script.

I know nothing about the PR other than it says it addresses this issue. When I look at its code it is not the way I would do it, but that is the beauty of code, everyone can do it their own way.

AussieWoji avatar Nov 19 '22 16:11 AussieWoji