Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The install.ps1 fails (dependency issues), 'Update-SessionEnvironment' is not recognized with/without Chocolately, able to install, not able to get it to output [fixed, but needs docs or better way to check this before or during runtime at script run or source) #407

Closed
D1esel-Dev opened this issue Jul 8, 2023 · 3 comments
Labels
🐛 bug Something isn't working 🚧 maintainer issue An issue that is being tackled by maintainers

Comments

@D1esel-Dev
Copy link

Description of the bug

When I first try an install of the CLI slight, it seams to 'Install' but fails to actually run?

PS C:\Users\zer0> slight
PS C:\Users\zer0> slight -h
PS C:\Users\zer0> slight --help

the error message it provides is as follows:

PowerShell 7.3.5
PS C:\Users\zer0> iex ((New-ObjectSystem.Net.WebClient).DownloadString('https://raw.githubusercontent.com/deislabs/spiderlightning/main/install.ps1

LATEST RELEASE: v0.5.1...
BINARY WILL BE STORED AT C:\slight.
DONLOADING FROM: https://github.com/deislabs/spiderlightning/releases/download/v0.5.1/slight-windows-x86_64.tar.gz...
EXTRACTED BINARY TAR.
Update-SessionEnvironment : The term 'Update-SessionEnvironment' 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:21 char:1

  • Update-SessionEnvironment
    • CategoryInfo : ObjectNotFound: (Update-SessionEnvironment:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

INSTALLED BINARY.
CLEANED UP.

PS C:\Users\zer0> ls -l /slight

Directory: C:\slight
Mode LastWriteTime Length Name
-a--- 6/2/2023 2:34 PM 38387712 slight.exe

PS C:\Users\zer0> slight
PS C:\Users\zer0>

No output here, why?? so I checked my current Environment variables to see if install.ps1 set them

My Used System Environment:

image

PS C:\Users\zer0> [Environment]::GetEnvironmentVariable('path', 'User')

C:\ProgramFiles\PowerShell\7;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Gpg4win..\GnuPG\bin;C:\Program Files\PuTTY;C:\JupyterLab;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\msys64\mingw64\bin;C:\slight

PS C:\Users\zer0> [Environment]::GetEnvironmentVariable('path', 'process')

C:\Program Files\PowerShell\7;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Gpg4win..\GnuPG\bin;C:\Program Files\PuTTY;C:\JupyterLab;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\msys64\mingw64\bin;C:\Program Files\PowerShell\7;C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Scripts;C:\Users\Administrator\AppData\Local\Programs\Python\Python311;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator.dotnet\tools;C:\Program Files\Git\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Nmap;C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\bin;C:\slight

YES!, we see here at the last line that : C:\slight is being added to path, and proof its IN the ACTUAL path:

image

but wait, why is it still not generating anything ??

PS C:\Users\zer0> slight new -n spidey@v0.5.1 rust && cd spidey
PS C:\Users\zer0> ls

Directory: C:\Users\zer0

Mode LastWriteTime Length Name
d---- 6/8/2023 7:53 PM .BigNox
d---- 7/7/2023 12:49 PM .docker
d---- 5/31/2023 7:39 AM .dotnet
d---- 6/1/2023 1:29 AM .ms-ad
d---- 6/17/2023 12:58 PM .VirtualBox
d---- 6/14/2023 7:03 PM .vscode
d-r-- 5/31/2023 10:51 PM Contacts
d-r-- 7/7/2023 12:54 PM Desktop
d-r-- 7/7/2023 3:33 PM Documents
d-r-- 7/6/2023 9:04 PM Downloads
d---- 7/6/2023 9:25 PM eclipse-workspace
d-r-- 5/31/2023 10:51 PM Favorites
d---- 6/19/2023 7:32 PM Fido
d-r-- 5/31/2023 10:51 PM Links
d-r-- 5/31/2023 10:51 PM Music
d-r-- 5/31/2023 10:51 PM Pictures
d---- 7/7/2023 12:56 PM rust-projects
d-r-- 5/31/2023 10:51 PM Saved Games
d-r-- 6/1/2023 4:34 PM Searches
d---- 7/7/2023 4:44 PM spiderlightning
d---- 6/14/2023 7:00 PM sunRay
d-r-- 5/31/2023 10:51 PM Videos
d---- 6/14/2023 7:57 PM VirtualBox VMs
d---- 6/5/2023 4:21 PM wsl2-pico
-a--- 6/8/2023 7:35 PM 45 nuuid.ini
-a--- 6/8/2023 7:35 PM 53 useruid.ini

I found out that the cmdlt 'Update-SessionEnvironment' was just not available to call. looks to be a Chocolatey CLI based Windows Package manger module here, (do not confuse with the outdated depreciated version that most may have if using older OS versions, here

however I seamed to not have any bin or initialization of it:

PS C:\Users\zer0> choco

choco: The term 'choco' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

SO i installed Choco from here:

PS C:\Users\zer0> choco

Chocolatey v2.1.0
Please run 'choco -?' or 'choco -?' for help menu.

Installed choco and and after re-starting script. no change,

PS C:\Users\zer0> iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/deislabs/spiderlightning/main/install.ps1'))

LATEST RELEASE: v0.5.1...
BINARY WILL BE STORED AT C:\slight.
DONLOADING FROM: https://github.com/deislabs/spiderlightning/releases/download/v0.5.1/slight-windows-x86_64.tar.gz...
EXTRACTED BINARY TAR.

  • Update-SessionEnvironment:
    • Line | 21 | Update-SessionEnvironment
    • | The term 'Update-SessionEnvironment' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

INSTALLED BINARY.
CLEANED UP.

To Reproduce

I personally do not know (yet) why this is a Bug or why it is for me at least breaking, I can only explain its behavior in my environment stated above.

Additional context

I Tested in different environments to try and make it work, such as VS code, and alternate PowerShell versions, all except for Linux or UNIX, which I do know very well but already have that env in WSL reserved for something else even though i very much know it would just work under that. YET windows seams to always give us some new worries...

Tested this inside the VS (Visual Studio) code's environment PS shell, and it returns the exact same behavior,
Testing with PS OG shell V1 (the original 'default' version packaged with any win install before upgrading) returns same behavior.
image

Testing with Admin rights yields same behavior:

image

PS C:\Users\zer0> iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/deislabs/spiderlightning/main/install.ps1'))

LATEST RELEASE: v0.5.1...
BINARY WILL BE STORED AT C:\slight.
DONLOADING FROM: https://github.com/deislabs/spiderlightning/releases/download/v0.5.1/slight-windows-x86_64.tar.gz...
EXTRACTED BINARY TAR.
Update-SessionEnvironment : The term 'Update-SessionEnvironment' 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:21 char:1

  • Update-SessionEnvironment
    • CategoryInfo : ObjectNotFound: (Update-SessionEnvironment:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

INSTALLED BINARY.
CLEANED UP.

PS C:\Users\zer0> slight new -n spidey@v0.5.1 rust && cd spidey
PS C:\Users\zer0>

Am I still missing something?? Do i have to explicitly add Update-SessionEnvironmenT to my environment path? or run them sideby side?
Either way, it should not be scoped like so.

@D1esel-Dev D1esel-Dev added 🐛 bug Something isn't working 🚧 maintainer issue An issue that is being tackled by maintainers labels Jul 8, 2023
@D1esel-Dev
Copy link
Author

D1esel-Dev commented Jul 8, 2023

Installing deps did solves something: in ref to #378

PS C:\Users\zer0> choco install openssl -y
Chocolatey v2.1.0
Installing the following packages:
openssl
By installing, you accept licenses for the packages.
Progress: Downloading openssl 1.1.1.2100... 100%
openssl v1.1.1.2100 [Approved]
openssl package files install completed. Performing other installation steps.
Installing 64-bit openssl...
openssl has been installed.
WARNING: No registry key found based on 'OpenSSL-Win'
PATH environment variable does not have C:\Program Files\OpenSSL-Win64\bin in it. Adding...
WARNING: OPENSSL_CONF has been set to C:\Program Files\OpenSSL-Win64\bin\openssl.cfg
openssl can be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
see the changes (or in powershell/cmd.exe just type refreshenv).
The install of openssl was successful.
Software installed to 'C:\Program Files\OpenSSL-Win64'
Chocolatey installed 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Users\zer0> slight -?
error: unexpected argument '-?' found
Usage: slight.exe [OPTIONS]
For more information, try '--help'.
PS C:\Users\zer0> slight -h
Usage: slight.exe [OPTIONS]
Commands:
run Run slight providing a config and a module
secret Add a secret to the application
add Download a SpiderLightning interface
new Start a new Slight project
buildjs Build a JS Slight project
help Print this message or the help of the given subcommand(s)
Options:
-c, --config
-h, --help Print help
-V, --version Print version

PS C:\Users\zer0> slight new -n spidey@v0.5.1 rust && cd spidey
PS C:\Users\zer0\spidey>

@D1esel-Dev D1esel-Dev changed the title The install.ps1 fails, 'Update-SessionEnvironment' is not recognized with/without Chocolately, able to install, not able to get it to output The install.ps1 fails (dependency issues), 'Update-SessionEnvironment' is not recognized with/without Chocolately, able to install, not able to get it to output Jul 8, 2023
@D1esel-Dev D1esel-Dev changed the title The install.ps1 fails (dependency issues), 'Update-SessionEnvironment' is not recognized with/without Chocolately, able to install, not able to get it to output The install.ps1 fails (dependency issues), 'Update-SessionEnvironment' is not recognized with/without Chocolately, able to install, not able to get it to output [fixed, but needs docs or better way to check this before or afterruntime Jul 8, 2023
@D1esel-Dev D1esel-Dev changed the title The install.ps1 fails (dependency issues), 'Update-SessionEnvironment' is not recognized with/without Chocolately, able to install, not able to get it to output [fixed, but needs docs or better way to check this before or afterruntime The install.ps1 fails (dependency issues), 'Update-SessionEnvironment' is not recognized with/without Chocolately, able to install, not able to get it to output [fixed, but needs docs or better way to check this before or during runtime at script run or source) Jul 8, 2023
@Mossaka
Copy link
Member

Mossaka commented Jul 15, 2023

Would you like to take a look at this issue as well? @danbugs

@danbugs
Copy link
Collaborator

danbugs commented Sep 11, 2023

I believe this is fixed by #419 – let me know if you still run into any issues.

@danbugs danbugs closed this as completed Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🚧 maintainer issue An issue that is being tackled by maintainers
Projects
None yet
Development

No branches or pull requests

3 participants