27

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?

2
  • When you issue nvm use node_version nvm will set the path to your node automatically.
    – David R
    Jul 17, 2017 at 8: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, 2017 at 8:12

5 Answers 5

52

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
2
  • 1
    what does it mean if nvm which node is different from which node? Jul 29, 2020 at 17:39
  • or we can use nvm which node current to give the node binary path Mar 14 at 0:22
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
1
  • Both answers are solid. But this leads to more info that you may or may not be looking for. Oct 22, 2019 at 0:31
6

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

0
2

nvm root command gives us path of the node exe

1
  • 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. Dec 13, 2022 at 15:33
2

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.