Aero Wang
Aero Wang

Reputation: 9227

Where is node while using nvm?

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?

Upvotes: 42

Views: 62465

Answers (5)

tibalt
tibalt

Reputation: 16164

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

Upvotes: 4

Kamalakar
Kamalakar

Reputation: 415

nvm root command gives us path of the node exe

Upvotes: 5

Stanislav Levental
Stanislav Levental

Reputation: 2225

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

Upvotes: 12

Yi Kai
Yi Kai

Reputation: 640

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

Upvotes: 6

zetavolt
zetavolt

Reputation: 3207

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

Upvotes: 72

Related Questions