1

My problem is almost the same as this one but i already set the default alias.

Once i open a new console nvm does not load the default node, this problem is also present with some SublimeText3 plugins (eslint, jscs for example).

The only way to make it work is to add nvm use default after loading nvm but i thik i am doing something wrong.

How can i make it work without the hack?


My configuration

  • brew 0.9.5
  • nvm 0.26.0 (installed using brew)
  • zsh (with oh-my-zsh)

I have nvm sourced in .zshenv with th following config:

export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
# nvm use default # <-- remove comment to make node available

nvm is configured as follows (result of the command nvm ls):

iojs-v3.0.0
v0.12.7
default -> iojs (-> iojs-v3.0.0)
node -> stable (-> v0.12.7) (default)
stable -> 0.12 (-> v0.12.7) (default)
iojs -> iojs-v3.0 (-> iojs-v3.0.0) (default)

Community
  • 1
  • 1
Volox
  • 1,068
  • 1
  • 12
  • 23

2 Answers2

2

oh-my-zsh includes a nvm plugin, I would recommend you to use it, but first

  1. remove from your .zshenv all changes
  2. remove the nvm install with brew uninstall
  3. install nvm using curl (official installation): curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.0/install.sh | bash this wont configure your profile to use it yet.
  4. edit the file at your users home called .zshrc finding the plugins section and there include nvm save it and source your profile or close and open again your terminal.
  5. use nvm to install a node version and set the default alias
edsadr
  • 1,087
  • 6
  • 17
  • Ok, it worked. The key point here seems to be the "**4** Adding the `nvm` plugin". I also moved the `nvm` activation lines added by the script from `.zshrc` to `.zshenv`. – Volox Aug 21 '15 at 08:04
  • @Volox After moving those lines to `.zshenv` did your shell become crazy slow? I did exactly the same, but my shell become super slow. – Rui Afonso Pereira Feb 29 '16 at 17:38
  • @RuiAfonsoPereira no, as far as i can tell there is no visible difference in speed. – Volox Mar 01 '16 at 13:35
0

In oh-my-zsh, you can go to /etc then use nano ~/.zshrc, find export PATH=$HOME/.nvm/versions/node/v16.5.0/bin/:$PATH change node version what you want

Tyler2P
  • 2,324
  • 26
  • 22
  • 31