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

Node.js uninstall Windows Installer .msi leaves stranded Corepack files #646

Closed
MikeMcC399 opened this issue Feb 11, 2025 · 3 comments
Closed

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Feb 11, 2025

Issue

Uninstalling Node.js that was previously installed using a Windows Installer .msi package leaves files in "C:\Program Files\nodejs" if corepack enable was executed.

This is probably expected behavior for Windows Installer, since the files left behind were not put there by the Windows Installer package. In contrast, Node.js version managers would typically uninstall everything as part of their uninstall process. So in comparison leaving files behind when using Windows Installer could be unexpected and it is not explicitly documented for Node.js or Corepack.

Steps to reproduce

Download the Node.js LTS Windows Installer (.msi) package from https://nodejs.org/en/download, for example

https://nodejs.org/dist/v22.13.1/node-v22.13.1-x64.msi

Open a CMD terminal window in the Downloads folder

msiexec.exe /package node-v22.13.1-x64.msi /quiet

Close and re-open CMD terminal window "Run as administrator"

corepack enable
msiexec.exe /uninstall node-v22.13.1-x64.msi /quiet
dir "C:\Program Files\nodejs"

Reproducible also with https://nodejs.org/dist/v22.14.0/node-v22.14.0-x64.msi

Logs

dir "C:\Program Files\nodejs"
 Volume in drive C has no label.
 Volume Serial Number is 664F-5523

 Directory of C:\Program Files\nodejs

11/02/2025  10:27    <DIR>          .
10/02/2025  19:14    <DIR>          ..
11/02/2025  10:26               314 pnpm
11/02/2025  10:26               210 pnpm.CMD
11/02/2025  10:26               849 pnpm.ps1
11/02/2025  10:26               314 pnpx
11/02/2025  10:26               210 pnpx.CMD
11/02/2025  10:26               849 pnpx.ps1
11/02/2025  10:26               314 yarn
11/02/2025  10:26               210 yarn.CMD
11/02/2025  10:26               849 yarn.ps1
11/02/2025  10:26               320 yarnpkg
11/02/2025  10:26               216 yarnpkg.CMD
11/02/2025  10:26               861 yarnpkg.ps1
              12 File(s)          5,516 bytes

Workaround

Applies only to Node.js installed on Windows from an .msi Windows Installer package

  1. Before uninstalling Node.js, execute
corepack disable
  1. After uninstalling Node.js, delete the files in C:\Program Files\nodejs
@inoyakaigor
Copy link

@MikeMcC399 Am I getting it right in case of problem I've met in #305 I can just delete these files manually?

@MikeMcC399
Copy link
Contributor Author

@inoyakaigor

Am I getting it right in case of problem I've met in #305 I can just delete these files manually?

I left the advice for you in #305 (comment).

The issue I logged here is related to your problem, but if you are using Node.js 23.7.0 which already has the fix then you shouldn't need to delete any files. A default installation should work for you.

As I suggested previously, if you want to discuss your individual situation further I would recommend that you open a new issue.

@MikeMcC399
Copy link
Contributor Author

The Node.js TSC vote stated as strategy decision:

Phase out later: stop distributing Corepack (i.e. the distribution will no longer contain a corepack executable) on future (i.e. 25+) release lines of Node.js – existing release lines as well as the very next (i.e. 24.x) will keep it as experimental.

So I no longer expect any effort on issues affecting Corepack only as it is bundled into Node.js. Windows Installer msi is a sub-set of distribution / installation methods. This issue only affects Microsoft Windows and only if a Node.js version manager is not used for installation.

There is already some related workaround advice in the README document, Manual installs section, added through #637.

Closing as not expected to be fixed.

@MikeMcC399 MikeMcC399 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants