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

[Package Issue]: CoreyButler.NVMforWindows install --scope=machine #92737

Closed
2 tasks done
NJT145 opened this issue Jan 2, 2023 · 4 comments
Closed
2 tasks done

[Package Issue]: CoreyButler.NVMforWindows install --scope=machine #92737

NJT145 opened this issue Jan 2, 2023 · 4 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Milestone

Comments

@NJT145
Copy link
Contributor

NJT145 commented Jan 2, 2023

Please confirm these before moving forward

  • I have searched for my issue and not found a work-in-progress/duplicate/resolved issue.
  • I have not been informed if the issue is resolved in a preview version of the winget client.

Category of the issue

Installation issue.

Brief description of your issue

Cannot install nvm at machine scope. Want to do it like Chocolatey does. There is a need for that.

Steps to reproduce

nope

Actual behavior

nope

Expected behavior

Need --scope=machine option, and machine's path update.

Environment

[winget --info]
Windows Package Manager v1.3.2691
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19045.2364
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.2691.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Screenshots and Logs

No response

@NJT145 NJT145 added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jan 2, 2023
@ghost ghost added the Needs-Triage This work item needs to be triaged by a member of the core team. label Jan 2, 2023
@Trenly
Copy link
Contributor

Trenly commented Jan 3, 2023

I believe this requires setting runtime variables (specifically %NVM_PATH%) before the install, something which winget currently is unable to do.

@denelon denelon removed the Needs-Triage This work item needs to be triaged by a member of the core team. label Jan 3, 2023
@NJT145
Copy link
Contributor Author

NJT145 commented Jan 15, 2023

Not before, but after. But you are right. I will create an issue request at nvm-windows github page, and inform you about the results.

@NJT145
Copy link
Contributor Author

NJT145 commented Jan 15, 2023

I created an issue at here for that issue.
Anyone can follow the results from there.
I will keep open this issue request for a while while I am waiting for an answer from my nvm-windows issue request.

@NJT145
Copy link
Contributor Author

NJT145 commented Feb 28, 2023

This issue wont going to fix. Developer plans to develop another tool based on nvm-windows...
As a result, I created a script in order to solve that. I put my code here, so anyone that will need a solution can use it.
Here is my windows powershell code:

winget install -e -i --id=CoreyButler.NVMforWindows --location="$env:PROGRAMDATA\nvm" --source=winget
if (-not ($null -eq [Environment]::GetEnvironmentVariable('NVM_HOME', 'User'))) { [Environment]::SetEnvironmentVariable('NVM_HOME', [Environment]::GetEnvironmentVariable('NVM_HOME', 'User'), 'Machine'); }; #[Environment]::SetEnvironmentVariable('NVM_HOME', '', 'User');
if (-not ($null -eq [Environment]::GetEnvironmentVariable('NVM_SYMLINK', 'User'))) { [Environment]::SetEnvironmentVariable('NVM_SYMLINK', [Environment]::GetEnvironmentVariable('NVM_SYMLINK', 'User'), 'Machine'); }; #[Environment]::SetEnvironmentVariable('NVM_SYMLINK', '', 'User');
$NVM_HOME = [Environment]::GetEnvironmentVariable('NVM_HOME', 'Machine');
if (-not [Environment]::GetEnvironmentVariable('Path', 'Machine').Split(";").Contains($NVM_HOME)) { $Old_Path = [Environment]::GetEnvironmentVariable('Path', 'Machine'); $New_Path = [System.String]::Concat($Old_Path, ';', $NVM_HOME); [Environment]::SetEnvironmentVariable('Path', $New_Path, 'Machine'); $Old_Path = $New_Path = $null; }
if ([Environment]::GetEnvironmentVariable('Path', 'User').Split(";").Contains($NVM_HOME)) { $Old_Path = [Environment]::GetEnvironmentVariable('Path', 'User'); $New_Path = $Old_Path.Replace(";$NVM_HOME", "").Replace("$NVM_HOME;", ""); [Environment]::SetEnvironmentVariable('Path', $New_Path, 'User'); $Old_Path = $New_Path = $null; }
$NVM_SYMLINK = [Environment]::GetEnvironmentVariable('NVM_SYMLINK', 'Machine');
if (-not [Environment]::GetEnvironmentVariable('Path', 'Machine').Split(";").Contains($NVM_SYMLINK)) { $Old_Path = [Environment]::GetEnvironmentVariable('Path', 'Machine'); $New_Path = [System.String]::Concat($Old_Path, ';', $NVM_SYMLINK); [Environment]::SetEnvironmentVariable('Path', $New_Path, 'Machine'); $Old_Path = $New_Path = $null; }
if ([Environment]::GetEnvironmentVariable('Path', 'User').Split(";").Contains($NVM_SYMLINK)) { $Old_Path = [Environment]::GetEnvironmentVariable('Path', 'User'); $New_Path = $Old_Path.Replace(";$NVM_SYMLINK", "").Replace("$NVM_SYMLINK;", ""); [Environment]::SetEnvironmentVariable('Path', $New_Path, 'User'); $Old_Path = $New_Path = $null; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

3 participants