29

I am on a MacOS, and I switched from Homebrew Node to NVM, and removed Node from Homebrew but then a lot of my previous packages cannot find Node anymore (Sublime, Heroku etc)...so I have to manually update the location of Node to these packages.

Where is Node while using NVM?

Aero Wang
  • 8,382
  • 14
  • 63
  • 99
  • When you issue **nvm use `node_version`** nvm will set the path to your node automatically. – David R Jul 17 '17 at 08:09
  • `which node` should show you the location of the Node executable, but that location changes each time you change Node version with `nvm`. It's better to also have a globally installed Node (I'd suggest using the official Node installer for Mac). – robertklep Jul 17 '17 at 08:12

5 Answers5

56

You can get the path to the executable to where node was installed with

nvm which node

Or any of the other NVM special aliases for node versions such as

nvm which default
zetavolt
  • 2,989
  • 1
  • 23
  • 33
9

NVM should set PATH variable to your node installation directory, it does this automatically after:

nvm current use `nvm current`

You can check variables like this:

env | grep NVM

Here is my output:

NVM_DIR=/Users/name/.nvm
NVM_CD_FLAGS=-q
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
NVM_PATH=/Users/name/.nvm/versions/node/v5.9.0/lib/node
NVM_BIN=/Users/name/.nvm/versions/node/v5.9.0/bin
Stanislav Levental
  • 2,165
  • 1
  • 14
  • 28
6

You can locate your node by running which node or command -v node

Yi Kai
  • 630
  • 6
  • 9
3

nvm root command gives us path of the node exe

Kamalakar
  • 389
  • 2
  • 9
  • This only works on the Windows implementation. Also, for me (as of 2022) it only shows where `nvm` itself is installed, not where the current node executable is. – Jacques Mathieu Dec 13 '22 at 15:33
3

Trying all the answers in 2023, nothing works:

nvm which node

nvm: Unknown command or option: "which" (see nvm -h for usage)

env|grep NVM

nvm root

nvm: Unknown command or option: "root" (see nvm -h for usage)

And finally!

env|grep nvm

nvm_current_version=v19.6.0 PATH=~/.local/share/nvm/v19.6.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

So I guess currently NVM keeps node in ~/.local/share/nvm

tibalt
  • 15,201
  • 1
  • 29
  • 22