58

I am doing this on OSX. I need to delete node. but after I type cmd: nvm uninstall v4.4.7 it prompts me that nvm: Cannot uninstall currently-active node version v4.4.7 How can I uninstall node completely?

sia
  • 537
  • 1
  • 6
  • 22
Henry
  • 2,819
  • 3
  • 18
  • 33
  • Same question: [npm - Uninstalling the currently active version of node.js with nvm](https://stackoverflow.com/q/47240567) – li ki Feb 03 '22 at 08:02

2 Answers2

152

just type following cmd:

$ nvm deactivate

then type the uninstall cmd.

Pallav Jha
  • 3,409
  • 3
  • 29
  • 52
Henry
  • 2,819
  • 3
  • 18
  • 33
  • Thx, that worked! Do I have to activate nvm after deactivating it? – gignu Jun 16 '21 at 15:12
  • 1
    @gignu , `nvm deactivate` does not remove nvm from PATH, but `$NVM_DIR/*/bin` , or say, the binary directory of installed node.js. About [`NVM_DIR`](https://github.com/nvm-sh/nvm/blob/2c0c34f10e6f415d1c6f60c54fcbf53a7670dec6/README.md#environment-variables). For me, `which node` outputs `~/.nvm/versions/node/v16.13.2/bin/node` and `nvm deactivate` outputs `~/.nvm/*/bin removed from ${PATH}` . – li ki Feb 03 '22 at 08:15
2

$ nvm deactivate is deprecated now.

For those who get the message Cannot uninstall currently linked node version - We have to unlink the default version before doing an uninstall

$ nvm unlink and then

$ nvm uninstall <version-number>

IMPORTANT: Edit on 30/Jan/2022: I am using a different version of nvm. Info

The above mentioned solution is applicable only for those who have installed @jchip/nvm.

  • `nvm unlink` is not a command on recent nvm version (0.39.1) – Flip Jan 29 '22 at 15:07
  • @Flip - Thanks for your comment. I was using nvm-windows and nvm version might not have been latest that time. See output of help command below. ``` >npm unlink -help npm uninstall [<@scope>/][@]... [--save-prod|--save-dev|--save-optional] [--no-save] aliases: un, unlink, remove, rm, r ``` So how can you say this answer is not useful. You can add a comment against my answer, but not sure how you can downvote this. Also the question was posted in 2016, how is it relevant to latest version of nvm. The latest version might not even have the issue – Vimal Maheedharan Jan 30 '22 at 09:30
  • 1
    1. your answer has now two different commands `nvm unlink` (still doesn't exist) and after edit `npm unlink` 2. how is situation of 2016 relevant in 2022? other answer did not get 118 upvotes because people are trying to recreate 2016 situation with unspecified nvm version of question starter. 3. "nvm deactivate is deprecated now" without any source of truth. We are now 1 year later, latest nvm version still has `nvm deactivate` and no word of "deprecated" 4. `nvm deactivate` and `npm unlink` are commands used for totally different purposes, read `npm unlink --help` and `nvm --help` – Flip Jan 30 '22 at 12:37
  • Thanks for sharing more details. I think I got the issue. I was using [Link](https://www.npmjs.com/package/@jchip/nvm) (See Usage section). If you notice there is no `deactivate` command there. My dev machine had this pre-installed. See this for command outputs - [Screen](https://github.com/vimal-here/my-images/blob/main/nvm-unlink.png). Need to check with my team why we're using this instead of [nvm](https://github.com/nvm-sh/nvm) – Vimal Maheedharan Jan 31 '22 at 13:36
  • 1
    Ok i upvoted your answer based on different versions of nvm https://github.com/jchip/nvm and https://github.com/nvm-sh/nvm – Flip Jan 31 '22 at 18:07
  • Since when `nvm deactivate` is depricated? https://github.com/nvm-sh/nvm/blob/master/README.md?plain=1#L495 – itsazzad Jun 19 '23 at 03:31