You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 244ae34
Browse filesBrowse the repository at this point in the historyBrowse files
fix(installer): uninstall official Node on install
A standard-user install cannot put NVM ahead of a system Node PATH entry. Ignore is removed. Adopt and Drop both uninstall with UAC, and a failed uninstall stops setup.
Fixes#1425
Co-authored-by: Cursor
Copy file name to clipboardExpand all lines: installer/officialnode.iss
+58-46Lines changed: 58 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
-
{ Official Node.js adopt / drop / ignore. Included from setup.iss [Code]. }
1
+
{ Official Node.js adopt / drop. Included from setup.iss [Code]. }
2
2
3
3
function OfficialNodeParam(): String;
4
4
var
5
5
Raw: String;
6
6
begin
7
7
Raw := LowerCase(Trim(ExpandConstant('{param:OFFICIALNODE}')));
8
-
if (Raw ='adopt') or (Raw ='drop') or (Raw ='ignore') then
8
+
if (Raw ='adopt') or (Raw ='drop') then
9
9
Result := Raw
10
10
else
11
-
Result :='ignore';
11
+
Result :='adopt';
12
12
end;
13
13
14
14
function IsNvmManagedPath(const PathValue: String): Boolean;
@@ -338,12 +338,10 @@ begin
338
338
Result := OfficialNodeAction;
339
339
if OfficialNodePage = nil then
340
340
Exit;
341
-
if OfficialNodePage.Values[0] then
342
-
Result :='adopt'
343
-
else if OfficialNodePage.Values[1] then
341
+
if OfficialNodePage.Values[1] then
344
342
Result :='drop'
345
343
else
346
-
Result :='ignore';
344
+
Result :='adopt';
347
345
end;
348
346
349
347
procedure CreateOfficialNodePage();
@@ -357,7 +355,7 @@ begin
357
355
Description :=
358
356
OfficialNodeSummary() + #13#10 +
359
357
'Location: ' + OfficialNodePath + #13#10#13#10 +
360
-
'Adopt copies this version and your global modules into NVM. Drop uninstalls official Node.js without copying. Ignore leaves it installed and puts NVM first on PATH.';
358
+
'The existing Node.js installation overrides NVM for Windows and must be removed. Removing it may require elevated privileges.';
361
359
362
360
OfficialNodePage := CreateInputOptionPage(
363
361
wpLicense,
@@ -367,16 +365,13 @@ begin
367
365
True,
368
366
False
369
367
);
370
-
OfficialNodePage.Add('Adopt — copy into NVM and keep official Node.js');
371
-
OfficialNodePage.Add('Drop — uninstall official Node.js (do not copy)');
372
-
OfficialNodePage.Add('Ignore — leave official Node.js, NVM PATH first');
368
+
OfficialNodePage.Add('Adopt — copy into NVM and uninstall the existing installation');
369
+
OfficialNodePage.Add('Drop — uninstall the existing installation (do not copy)');
373
370
374
-
if OfficialNodeAction ='adopt' then
375
-
OfficialNodePage.Values[0] := True
376
-
else if OfficialNodeAction ='drop' then
371
+
if OfficialNodeAction ='drop' then
377
372
OfficialNodePage.Values[1] := True
378
373
else
379
-
OfficialNodePage.Values[2] := True;
374
+
OfficialNodePage.Values[0] := True;
380
375
end;
381
376
382
377
function AdoptOfficialNodeVersion(): Boolean;
@@ -453,6 +448,23 @@ begin
453
448
AppendInstallLog('AdoptOfficialNode: nvm use ' + UseVer);
454
449
end;
455
450
451
+
function UninstallResultOk(const Started: Boolean; const ResultCode: Integer): Boolean;
452
+
begin
453
+
Result := Started and ((ResultCode =0) or (ResultCode =3010) or (ResultCode =1641));
0 commit comments