Chocolatey Uninstall NodeJS Windows 8

Ok, so I installed NodeJS by using cinst nodejs Which installs NodeJS into the Chocolatey bin directory with a dependency on NPM.

I then realised that I wanted to install NodeJS.Install instead which installs NodeJS to my ProgramFiles Directory using the main NodeJS install with a dependency on NPM.

My Question: Now that both are installed. Which will be used when I run a node or NPM command and how do I uninstall NodeJS from the Chocolatey bin if cuninst nodejs does not work?

2 Answers

The installed version of nodejs comes with npm installed so you don't need that. However removing the nodejs package is not enough as it is a meta package that points to either the *.install or *.commandline packages.

Please do the following:

  1. Ensure you are on the more recent version of choco (0.9.9.x series)
  2. choco uninstall npm -dvyaf
  3. choco uninstall nodejs.commandline -dvyaf

This will remove all versions of npm and remove the bin files (shim redirects that are on the path. Then it will remove the portable version of nodejs (nodejs.commandline) and all versions. These are force removes to clean up the directories completely.

If you have already done some of this, just head into the %ChocolateyInstall%\lib directory and remove the folders that start with npm and nodejs.commandline.

Ok, so I did some experimenting and as it turns out, cuninst nodejs does not get the job done because NodeJS Requires a chocolateyUninstall.ps1 in the package itself, of which many of the currently available packages do not have.

So if I run the command:
choco list -localonly

I get back:

curl 7.28.1
...
...
nodejs.commandline 0.10.35
nodejs.install 0.10.35
npm 1.4.9

The item I want to remove is nodejs 0.10.35 as this is the Chocolatey bin install. I want to keep the others. So I just use the name as I see it when I listed out my packages nodejs 0.10.35 or in otherwords:

C:\Windows\System32> cuninst nodejs 0.10.35

Now when I run:
choco list -localonly

I get back:

curl 7.28.1
...
...
nodejs 0.10.35
nodejs.commandline 0.10.35
nodejs.install 0.10.35
npm 1.4.9

Now the additional version that I setup the first time is gone. It never setup 2 versions of NPM because it was a dependency which already existed when I went to setup NodeJS.Install the 2nd time. Also when I had both installed it was defaulting to using the Chocolatey/bin version for some reason, not the ProgramFiles version. I thought that was wierd.

Please feel free to answer this question if anything I am saying appears to be wrong. I am not a power user when it comes to Chocolatey so, if you know for a fact my answer is wrong in one way or another I will check out your answer and mark it as correct if it indeed corrects my answer

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like