Raku / App-Rakubrew

Raku environment manager
https://rakubrew.org/
Other
26 stars 13 forks source link

Powershell installation #15

Closed antoniogamiz closed 4 years ago

antoniogamiz commented 4 years ago

The following commands have been executed from cmd:

I installed rakubrew for cmd without any problems following the instructions from https://rakubrew.org/. Today, I tried to use raku and zef from PowerShell but I get the following error:

raku : The term 'raku' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ raku
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (raku:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Do I have to re-install everything following the instructions for PowerShell? It would be really helpful if the cmd installation process updates the PATH for PowerShell too. Maybe this is done automatically by Windows (I suppose all terminals should have the same PATH variable).

This is the output of PATH variables in each terminal:

PS C:\Users\anton> $env:PATH
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\nodejs\;C:\Program Files\PowerShell\7\;C:\Ruby27-x64\bin;C:/Users/anton/rakudobrew/bin;C:\Users\anton\rakudobrew\shims;C:\Users\anton\rakudobrew\bin;C:\Users\anton\rakudobrew\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\nodejs\;C:\Users\anton\AppData\Local\Microsoft\WindowsApps;C:\Program Files\MiKTeX 2.9\miktex\bin;C:\Users\anton\AppData\Local\Microsoft\WindowsApps;C:\Users\anton\AppData\Roaming\npm;C:\Users\anton\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\Graphviz2.38\bin;C:\Program Files\7-Zip;C:\Program Files (x86)\Vim\vim82
PS C:\Users\anton>
C:\Users\anton>echo %PATH%
C:\rakubrew\versions\moar-2020.06\install\bin;C:\rakubrew\versions\moar-2020.06\install\share\perl6\site\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\nodejs\;C:\Program Files\PowerShell\7\;C:\Ruby27-x64\bin;C:/Users/anton/rakudobrew/bin;C:\Users\anton\rakudobrew\shims;C:\Users\anton\rakudobrew\bin;C:\Users\anton\rakudobrew\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\nodejs\;C:\Users\anton\AppData\Local\Microsoft\WindowsApps;C:\Program Files\MiKTeX 2.9\miktex\bin;C:\Users\anton\AppData\Local\Microsoft\WindowsApps;C:\Users\anton\AppData\Roaming\npm;C:\Users\anton\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\Graphviz2.38\bin;C:\Program Files\7-Zip;C:\Program Files (x86)\Vim\vim82
antoniogamiz commented 4 years ago

I have tried some of the solutions described in this question, but it does not work (moreover, I installed raku several days ago so I have rebooted my machine a fair number of times).

I have resolved the problem with:

$env:PATH += ";C:\rakubrew\versions\moar-2020.06\install\bin;C:\rakubrew\versions\moar-2020.06\install\share\perl6\site\bin"

But this is temporal, so it would be really helpful if this is done by rakubrew.

patrickbkr commented 4 years ago

As you already suspected, rakubrew needs to be installed separately for cmd and Powershell. The reason is: Rakubrew does not manipulate the system wide PATH variable but the one of the currently running cmd / Powershell window. As such any changes to the PATH rakubrew does in a Powershell window have no effect on any CMD windows (or the other way around), or even the system wide PATH.

A possible "solution" to this might be to adapt the installation instructions to instruct the user to set up both hooks Powershell and CMD in a single big command. I'm not sure I like this though as the CMD instructions involve quite some manual work and I don't want to put this extra work on everyone that only wants to use rakubrew in Powershell.

antoniogamiz commented 4 years ago

Hum, that makes sense. Then, I think a warning in the installation instructions will be helpful.