NVM cannot load default node with default alias set

↘锁芯ラ 提交于 2019-12-23 03:46:22

问题


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)


回答1:


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


来源:https://stackoverflow.com/questions/32069548/nvm-cannot-load-default-node-with-default-alias-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!