nvm: nvm use message not formatted properly and saying a version I have installed is not.

  • Operating system and version: Mac OS Sierra 10.12.5 (16F73)

  • nvm debug output:

xueye$ nvm debug
nvm --version: v0.31.1
$SHELL: /bin/bash
$HOME: /Users/xueye
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: v7.3.0
which node: $NVM_DIR/versions/node/v7.3.0/bin/node
which iojs:
which npm: $NVM_DIR/versions/node/v7.3.0/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v7.3.0
npm root -g: $NVM_DIR/versions/node/v7.3.0/lib/node_modules
  • nvm ls output:
xueye$ nvm ls
         v4.2.4
         v4.4.4
         v5.6.0
         v6.3.1
         v6.9.2
        v6.10.2
->       v7.3.0
         v7.6.0
         v7.9.0
         system
default -> node (-> v7.9.0)
node -> stable (-> v7.9.0) (default)
stable -> 7.9 (-> v7.9.0) (default)
iojs -> N/A (default)
  • How did you install nvm? (e.g. install script in readme, homebrew): I installed it via curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

  • What steps did you perform?

While using node 7.3, I navigated to my project directory with the following .nvmrc file:

xueye$ cat .nvmrc
v7.9.0

I proceeded to type nvm use which failed. I then tried nvm install which failed.

  • What happened?

I got the following message:

xueye$ nvm use
>ound '/Users/xueye/Work/proj/.nvmrc' with version <v7.9.0
" is not yet installed

xueye$ nvm install
>ound '/Users/xueye/Work/proj/.nvmrc' with version <v7.9.0
' not found - try `nvm ls-remote` to browse available versions.
  • What did you expect to happen?

I expected nvm to switch node the 7.9.0

  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?

My ~/.bash_profile is:

xueye$ cat ~/.bash_profile

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

export PATH="$HOME/.node/bin:$PATH"
export PATH="/usr/local/mysql/bin:$PATH"
source ~/.bashrc

export PATH=/Users/xueye/Library/Android/sdk/tools:$PATH
export PATH=/Users/xueye/Library/Android/sdk/platform-tools:$PATH
export PATH="/usr/local/sbin:$PATH"
alias cf='/Users/xueye/.cfscript'

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  source $(brew --prefix)/etc/bash_completion
fi

My .bashrc is:

xueye$ cat ~/.bashrc
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
NPM_PACKAGES="${HOME}/.npm-packages"

# Unset manpath so we can inherit from /etc/manpath via the `manpath` command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"

PATH="$NPM_PACKAGES/bin:$PATH"

eval `ssh-agent`
ssh-add ~/.ssh/id_rsa

export NVM_DIR="/Users/xueye/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

export PATH="$HOME/.yarn/bin:$PATH"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I’m on a mac and found this issue. Figured out the person who created the .nvmrc file was on a windows machine and the line endings are different there. Recreated the .nvmrc file on my mac and nvm use ran fine. Hope this helps others.

Just noticed you asked me to try a new version; I’ll try to get that done this week and let you know.

I can confirm that v0.33.11 does not experience this issue.

With or without a trailing newline, nvm parses the .nvmrc file correctly for me.