Uninstalling the currently active version of node.js with nvm

。_饼干妹妹 提交于 2019-12-04 18:50:56

问题


On Ubuntu 16.04, I mistakenly used root to install nvm, and then to install node.js 8.8.1 via nvm. I also used nvm alias default 8.8.1, thinking it would correct my error.

Now I would like to:

  1. Remove the default alias
  2. Uninstall node 8.8.1
  3. Uninstall npm 4.8.5, which came along with node
  4. Uninstall nvm
  5. Reinstall everything correctly for the right non-sudo user

It looks like I've succeeded with the first part:

# nvm unalias default
Deleted alias default - restore it with `nvm alias "default" "8.8.1"`

But nvm refuses to uninstall node 8.8.1, because it is the only version installed:

# nvm uninstall 8.8.1                                                                                                                             
nvm: Cannot uninstall currently-active node version, v8.8.1 (inferred from 8.8.1).

I am guessing that I first need to disactivate node 8.8.1, but I see nothing in the output of nvm --help which would appear to do this.

What steps do I need to take to completely remove node.js, npm and nvm from the machine before re-installing everything correctly?


回答1:


First type

$ nvm deactivate

Then type

$ nvm uninstall 8.8.1



回答2:


rm -Rf ~/.nvm

This is the nuclear option in my case. just -R would ask me if I really wanted to delete every file in the nvm folder.




回答3:


You can uninstall the nodejs by using the following command.

yum remove nodejs

However, this will not remove the nvm from your linux box. To remove that try the below command.

nvm unload



来源:https://stackoverflow.com/questions/47240567/uninstalling-the-currently-active-version-of-node-js-with-nvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!