@@ -32,7 +32,7 @@ IPyRunner pyRunner
3232 private const string TkinterDownloadUrl =
3333 "https://cdn.lykos.ai/tkinter-cpython-embedded-3.10.11-win-x64.zip" ;
3434
35- private const string NodeDownloadUrl = "https://nodejs.org/dist/v20.11.0 /node-v20.11.0 -win-x64.zip" ;
35+ private const string NodeDownloadUrl = "https://nodejs.org/dist/v20.19.3 /node-v20.19.3 -win-x64.zip" ;
3636
3737 private const string Dotnet7DownloadUrl =
3838 "https://download.visualstudio.microsoft.com/download/pr/2133b143-9c4f-4daa-99b0-34fa6035d67b/193ede446d922eb833f1bfe0239be3fc/dotnet-sdk-7.0.405-win-x64.zip" ;
@@ -69,6 +69,7 @@ IPyRunner pyRunner
6969 private string TkinterExtractPath => PythonDir ;
7070 private string TkinterExistsPath => Path . Combine ( PythonDir , "tkinter" ) ;
7171 private string NodeExistsPath => Path . Combine ( AssetsDir , "nodejs" , "npm.cmd" ) ;
72+ private string NodeExePath => Path . Combine ( AssetsDir , "nodejs" , "node.exe" ) ;
7273 private string NodeDownloadPath => Path . Combine ( AssetsDir , "nodejs.zip" ) ;
7374 private string Dotnet7DownloadPath => Path . Combine ( AssetsDir , "dotnet-sdk-7.0.405-win-x64.zip" ) ;
7475 private string Dotnet8DownloadPath => Path . Combine ( AssetsDir , "dotnet-sdk-8.0.101-win-x64.zip" ) ;
@@ -109,7 +110,7 @@ public async Task RunGit(
109110 onProcessOutput ,
110111 environmentVariables : new Dictionary < string , string >
111112 {
112- { "PATH" , Compat . GetEnvPathWithExtensions ( GitBinPath ) }
113+ { "PATH" , Compat . GetEnvPathWithExtensions ( GitBinPath ) } ,
113114 }
114115 ) ;
115116 await process . WaitForExitAsync ( ) . ConfigureAwait ( false ) ;
@@ -127,7 +128,7 @@ public Task<ProcessResult> GetGitOutput(ProcessArgs args, string? workingDirecto
127128 workingDirectory : workingDirectory ,
128129 environmentVariables : new Dictionary < string , string >
129130 {
130- { "PATH" , Compat . GetEnvPathWithExtensions ( GitBinPath ) }
131+ { "PATH" , Compat . GetEnvPathWithExtensions ( GitBinPath ) } ,
131132 }
132133 ) ;
133134 }
@@ -148,6 +149,21 @@ public async Task RunNpm(
148149 onProcessOutput ? . Invoke ( ProcessOutput . FromStdErrLine ( result . StandardError ) ) ;
149150 }
150151
152+ // NOTE TO FUTURE DEVS: if this is causing merge conflicts with dev, just nuke it we don't need anymore
153+ private async Task < string > RunNode (
154+ ProcessArgs args ,
155+ string ? workingDirectory = null ,
156+ IReadOnlyDictionary < string , string > ? envVars = null
157+ )
158+ {
159+ var result = await ProcessRunner
160+ . GetProcessResultAsync ( NodeExePath , args , workingDirectory , envVars )
161+ . ConfigureAwait ( false ) ;
162+
163+ result . EnsureSuccessExitCode ( ) ;
164+ return result . StandardOutput ?? result . StandardError ?? string . Empty ;
165+ }
166+
151167 public Task InstallPackageRequirements ( BasePackage package , IProgress < ProgressReport > ? progress = null ) =>
152168 InstallPackageRequirements ( package . Prerequisites . ToList ( ) , progress ) ;
153169
@@ -214,7 +230,7 @@ public async Task InstallAllIfNecessary(IProgress<ProgressReport>? progress = nu
214230 public async Task UnpackResourcesIfNecessary ( IProgress < ProgressReport > ? progress = null )
215231 {
216232 // Array of (asset_uri, extract_to)
217- var assets = new [ ] { ( Assets . SevenZipExecutable , AssetsDir ) , ( Assets . SevenZipLicense , AssetsDir ) , } ;
233+ var assets = new [ ] { ( Assets . SevenZipExecutable , AssetsDir ) , ( Assets . SevenZipLicense , AssetsDir ) } ;
218234
219235 progress ? . Report ( new ProgressReport ( 0 , message : "Unpacking resources" , isIndeterminate : true ) ) ;
220236
@@ -487,12 +503,31 @@ await downloadService.DownloadToFileAsync(
487503 [ SupportedOSPlatform ( "windows" ) ]
488504 public async Task InstallNodeIfNecessary ( IProgress < ProgressReport > ? progress = null )
489505 {
490- if ( File . Exists ( NodeExistsPath ) )
491- return ;
506+ // NOTE TO FUTURE DEVS: if this is causing merge conflicts with dev, just nuke it we don't need anymore
507+ var nodeFolder = new DirectoryPath ( AssetsDir , "nodejs" ) ;
508+ if ( nodeFolder . Exists )
509+ {
510+ try
511+ {
512+ var result = await RunNode ( "-v" ) ;
513+ if ( result . Contains ( "20.19.3" ) )
514+ {
515+ Logger . Debug ( "Node.js already installed at {NodeExistsPath}" , NodeExistsPath ) ;
516+ return ;
517+ }
518+ }
519+ catch ( Exception )
520+ {
521+ // ignored
522+ }
523+
524+ Logger . Warn ( "Node.js version mismatch, reinstalling..." ) ;
525+ await nodeFolder . DeleteAsync ( true ) ;
526+ }
492527
493528 await DownloadAndExtractPrerequisite ( progress , NodeDownloadUrl , NodeDownloadPath , AssetsDir ) ;
494529
495- var extractedNodeDir = Path . Combine ( AssetsDir , "node-v20.11.0 -win-x64" ) ;
530+ var extractedNodeDir = Path . Combine ( AssetsDir , "node-v20.19.3 -win-x64" ) ;
496531 if ( Directory . Exists ( extractedNodeDir ) )
497532 {
498533 Directory . Move ( extractedNodeDir , Path . Combine ( AssetsDir , "nodejs" ) ) ;
@@ -591,7 +626,7 @@ public async Task InstallHipSdkIfNecessary(IProgress<ProgressReport>? progress =
591626 Arguments = "-install -log hip_install.log" ,
592627 UseShellExecute = true ,
593628 CreateNoWindow = true ,
594- Verb = "runas"
629+ Verb = "runas" ,
595630 } ;
596631
597632 if ( Process . Start ( info ) is { } process )
@@ -755,14 +790,14 @@ private async Task PatchHipSdkIfNecessary(IProgress<ProgressReport>? progress)
755790 {
756791 _ when downloadUrl . Contains ( "gfx1201" ) => null ,
757792 _ when downloadUrl . Contains ( "gfx1150" ) => "rocm gfx1150 for hip skd 6.2.4" ,
758- _ when downloadUrl . Contains ( "gfx1103.AMD" )
759- => "rocm gfx1103 AMD 780M phoenix V5.0 for hip skd 6.2.4" ,
793+ _ when downloadUrl . Contains ( "gfx1103.AMD" ) =>
794+ "rocm gfx1103 AMD 780M phoenix V5.0 for hip skd 6.2.4" ,
760795 _ when downloadUrl . Contains ( "gfx1034" ) => "rocm gfx1034-gfx1035-gfx1036 for hip sdk 6.2.4" ,
761796 _ when downloadUrl . Contains ( "gfx1032" ) => "rocm gfx1032 for hip skd 6.2.4(navi21 logic)" ,
762797 _ when downloadUrl . Contains ( "gfx1031" ) => "rocm gfx1031 for hip skd 6.2.4 (littlewu's logic)" ,
763- _ when downloadUrl . Contains ( "gfx1010" )
764- => "rocm gfx1010-xnack-gfx1011-xnack-gfx1012-xnack- for hip sdk 6.2.4" ,
765- _ => null
798+ _ when downloadUrl . Contains ( "gfx1010" ) =>
799+ "rocm gfx1010-xnack-gfx1011-xnack-gfx1012-xnack- for hip sdk 6.2.4" ,
800+ _ => null ,
766801 } ;
767802
768803 var librarySourceDir = rocmLibsExtractPath ;
0 commit comments