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

Cant uninstall n and node #327

Closed
krzysieki opened this issue Nov 27, 2015 · 20 comments
Closed

Cant uninstall n and node #327

krzysieki opened this issue Nov 27, 2015 · 20 comments

Comments

@krzysieki
Copy link

Hi

My system is Ubuntu 14.04LTS.
So I installed n with "sudo npm install -g n".

Next, I installed node 4.2.1 using n
N says now that 4.2.1 is the only node on my env.

What should I do to remove node and n?

n rm 4.2.1

results in
"Error: cannot remove currently active version (node/4.2.1)"

PS
Thanks for your work!

@knotech
Copy link

knotech commented Dec 5, 2015

I had to use sudo n rm 4.2.0. That worked for me on OSX yosemite. Does that solve it for you on Ubuntu?

@sunh3
Copy link

sunh3 commented Dec 9, 2015

I am on Linux mint 17.2 and I have the same issue.

using sudo n rm does not help

@knotech
Copy link

knotech commented Dec 9, 2015

Okay, so n will not uninstall the last version of node available to it.
And it left me with a broken version of npm.

I dealt with this in time-tight situation, but If I recall correctly when you install n it rewrites the paths to node from /usr/local/bin/node to (I think.. ) /opt/local/bin/ or some other directory. I did it in OSX.

On Ubuntu, it seems to be located in /usr/bin/node when I do an ~$ ls -la which node`` it's a symlink to /etc/alternatives/node

What I did was go manually delete the new locations that n had created for node and npm. The package manager I used to install node originally couldn't find them, but I would type node -v and get some version number. So I Symlinked the original locations of node and npm back to /usr/local/bin/node (/usr/bin/node in your cases), to uninstall them with the package manager that I originally used to install them.

Then I followed the steps here http://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x

The paths are going to be different because it's Ubuntu, but the principal is the same. You're going to have to find and delete the remnants, like globally install modules, wherever they're located, and then reinstall node and npm.

@knotech
Copy link

knotech commented Dec 9, 2015

@sunh3 see #328 if npm isn't broken you should try to reset the prefix, to where you had npm installed orignally, and clean it up from there.

@krzysieki
Copy link
Author

Thanks @knotech and I confirm that the manual steps above, from stackoverflow, worked. But still, I suppose there should be a way to uninstall all node versions installed with n. And now it seems that n does not allow to fully uninstall itself (with installed "nodes")

@knotech
Copy link

knotech commented Dec 13, 2015

Yeah, that seemed to be the problem, the fact that node had been installed from a different source, and n borked the symlinks. I concur, there should be a way to uninstall it, I'm bummed I can't use it in production.

@pentool
Copy link

pentool commented Feb 2, 2016

I've contacted the node team because I had the same issue. I am new to node/npm and somehow, apparently I installed node and from somewhere else I also got n installed. The node them was kind enough to point out that 'n' is the node version manager (I didn't even know that) and recommended to post my issue here.

Since I didn't know what 'n' is, I have followed all possible uninstall recommendation found on this page: https://docs.npmjs.com/misc/removing-npm but none of them uninstalled the node version found in the 'n' directory.

Since I wasn't sure what I'm facing with, I solved this problem by doing a clean install of my system :-) This actually took me less time (around 30 minutes) compared to how much time and frustration it took me to research this issue and still not founding a solution :-)

OS X El Crapitan 10.11.3

@monapasan
Copy link

Is there any workaround yet ?

@pentool
Copy link

pentool commented Feb 24, 2016

As for me, I just did a clean install of my system. Hate having gunk I can't decently clean out.

@naktinis
Copy link

So it's impossible to fully uninstall n? I also get "Error: cannot remove currently active version". Am I missing something?

@troy0820
Copy link
Collaborator

@naktinis are you trying to uninstall n or a specific node version? It isn't going to let you uninstall a version that you are currently using. If you want to uninstall global npm packages, use npm unistall -g n

@yun-cn
Copy link

yun-cn commented Sep 4, 2017

@naktinis npm uninstall -g n

@LeoCecilia
Copy link

LeoCecilia commented Feb 6, 2018

when you use [email protected], you use the command to uninstall node.

cd /usr/local/n/versions/node && rm -rf 6.0.0

@dandv
Copy link

dandv commented Jun 21, 2018

See #169 for workarounds. This issue was raised more than 4 years ago.

@shadowspawn
Copy link
Collaborator

shadowspawn commented Mar 27, 2019

This issue has not had any activity in over six months.

I have opened a new issue #540 with some research and ideas about what we might do in future. Subscribe to that issue for updates and/or give it a 👍

Thank you for your contributions.

@shadowspawn
Copy link
Collaborator

n uninstall has been added in v4.1.0. It deletes node and npm from the install destination (N_PREFIX or /usr/local). It does not affect the cached downloaded versions.

@ollyde
Copy link

ollyde commented Dec 25, 2020

@shadowspawn this compeltely breaks my system, even brew reinstall node@12 emits -bash: node: command not found

@shadowspawn
Copy link
Collaborator

@OllyDixon
Try a new shell (or Terminal window). Maybe the old location is still in the cache.

Otherwise in very general terms, node is found by being installed somewhere on your hard drive, and that location being in your shell PATH.

echo $PATH
command -v node

@bngbog
Copy link

bngbog commented Jun 19, 2024

Seriously, this is not fun at all. I just did npm install -g n today and now I want to unsintall it and it will not. I run the command. Than I look in the system, n is still there. A big thumbs down!

@shadowspawn
Copy link
Collaborator

@bngbog you did not say what command you ran to uninstall or where in the system n remained, but to uninstall the n executable which you installed using npm install -g n you use:

npm uninstall -g n

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