Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverting to nvm default version Now using node v10.15.3 (npm v6.9.0) repeatedly #2018

Closed
Natetronn opened this issue Mar 21, 2019 · 12 comments
Labels
needs followup We need some info or action from whoever filed this issue/PR.

Comments

@Natetronn
Copy link

Natetronn commented Mar 21, 2019

  • Operating system and version:
    Ubuntu 18.04.2

  • nvm debug output:

    nvm --version: v0.34.0
    $SHELL: /usr/bin/zsh
    $SHLVL: 1
    $HOME: /home/nate
    $NVM_DIR: '$HOME/.nvm'
    $PATH: $NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/v10.15.3/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn:/usr/local/bin:$NVM_DIR/versions/node/v10.15.3/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/stable/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn:/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn:/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn:/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn:/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn:/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn:/usr/local/bin:$NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/v11.12.0/bin:$NVM_DIR/versions/node/v11.12.0/bin:$NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/v10.15.3/bin:$NVM_DIR/versions/node/v10.15.3/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn:/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:/usr/bin/yarn::$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    $PREFIX: ''
    $NPM_CONFIG_PREFIX: ''
    $NVM_NODEJS_ORG_MIRROR: ''
    $NVM_IOJS_ORG_MIRROR: ''
    shell version: 'zsh 5.4.2 (x86_64-ubuntu-linux-gnu)'
    uname -a: 'Linux 4.18.0-16-generic #17~18.04.1-Ubuntu SMP Tue Feb 12 13:35:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux'
    OS version: Ubuntu 18.04.2 LTS  
    curl: /usr/bin/curl, curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
    wget: /usr/bin/wget, GNU Wget 1.19.4 built on linux-gnu.
    git: /usr/bin/git, git version 2.17.1
    grep: grep: aliased to grep  --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}), grep (GNU grep) 3.1
    awk: /usr/bin/awk, GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
    sed: /bin/sed, sed (GNU sed) 4.4
    cut: /usr/bin/cut, cut (GNU coreutils) 8.28
    basename: /usr/bin/basename, basename (GNU coreutils) 8.28
    rm: /bin/rm, rm (GNU coreutils) 8.28
    mkdir: /bin/mkdir, mkdir (GNU coreutils) 8.28
    xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0-git
    nvm current: 
    which node: node: aliased to nodejs
    which iojs: iojs not found
    which npm: $NVM_DIR/versions/node/v10.15.3/bin/npm
    npm config get prefix: $NVM_DIR/versions/node/v10.15.3
    npm root -g: $NVM_DIR/versions/node/v10.15.3/lib/node_modules
  • nvm ls output:

      iojs-v3.3.1
         v10.15.3
           system
              default -> stable (-> v10.15.3)
              iojs -> iojs-v3.3 (-> iojs-v3.3.1) (default)
              node -> stable (-> v10.15.3) (default)
              stable -> 10.15 (-> v10.15.3) (default)
              unstable -> N/A (default)
              lts/* -> lts/dubnium (-> v10.15.3)
              lts/argon -> v4.9.1 (-> N/A)
              lts/boron -> v6.17.0 (-> N/A)
              lts/carbon -> v8.15.1 (-> N/A)
              lts/dubnium -> v10.15.3
  • How did you install nvm? (e.g. install script in readme, Homebrew):
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

  • What steps did you perform?
    Ran the above and removed export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm from ~/bashrc and placed it into ~/.zshrc

  • What happened?
    When running some commands I get the following over and over again. I've tried setting defaults but, that didn't seem to help.

    ~ cd ..
    Reverting to nvm default version
    Now using node v10.15.3 (npm v6.9.0)
    ➜  /home 
    
  • What did you expect to happen?

    I expect not to the see the the below message over and over again:

    Reverting to nvm default version
    Now using node v10.15.3 (npm v6.9.0)
  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?

In .zshrc I have the following:

# If you come from bash you might have to change your $PATH.
export PATH="$HOME/bin:/usr/local/bin:/usr/bin/yarn:`yarn global bin`:$PATH"

# nmv
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
#[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
  local node_version="$(nvm version)"
  local nvmrc_path="$(nvm_find_nvmrc)"

  if [ -n "$nvmrc_path" ]; then
    local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

    if [ "$nvmrc_node_version" = "N/A" ]; then
      nvm install
    elif [ "$nvmrc_node_version" != "$node_version" ]; then
      nvm use
    fi
  elif [ "$node_version" != "$(nvm version default)" ]; then
    echo "Reverting to nvm default version"
    nvm use default
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

# Linuxbrew
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)

# yarn work around
alias node=nodejs
@ljharb
Copy link
Member

ljharb commented Mar 21, 2019

That text, "Reverting to nvm default version", does not come from nvm. Perhaps you've added a script that takes over cd and outputs that? There's a few such scripts in the readme, but none of them are actually part of nvm itself.

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Mar 21, 2019
@Natetronn
Copy link
Author

Natetronn commented Mar 21, 2019

Thanks for the reply! I'm looking into that. In the meantime, I tried removing nvm and starting fresh. I do see there is an issue with install and cd

The error itself and the full output below it:

/home/nate/.nvm/nvm.sh: line 25: cd: -q: invalid option
cd: usage: cd [-L|[-P [-e]] [-@]] [dir]
➜  ~ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13226  100 13226    0     0  56042      0 --:--:-- --:--:-- --:--:-- 56042
=> Downloading nvm from git to '/home/nate/.nvm'
=> Cloning into '/home/nate/.nvm'...
remote: Enumerating objects: 278, done.
remote: Counting objects: 100% (278/278), done.
remote: Compressing objects: 100% (249/249), done.
remote: Total 278 (delta 33), reused 93 (delta 16), pack-reused 0
Receiving objects: 100% (278/278), 142.36 KiB | 3.31 MiB/s, done.
Resolving deltas: 100% (33/33), done.
=> Compressing and cleaning up git repository

=> Appending nvm source string to /home/nate/.bashrc
=> Appending bash_completion source string to /home/nate/.bashrc
/home/nate/.nvm/nvm.sh: line 25: cd: -q: invalid option
cd: usage: cd [-L|[-P [-e]] [-@]] [dir]
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

@Natetronn
Copy link
Author

Also, after removal I get the following now:

Reverting to nvm default version
N/A: version "default -> N/A" is not yet installed.

You need to run "nvm install default" to install it before using it.

@ljharb
Copy link
Member

ljharb commented Mar 21, 2019

You should try to remove your override to cd - check your zshrc

@Natetronn
Copy link
Author

Natetronn commented Mar 21, 2019

Thanks again for your help!

I don't have a manual override that I know of. Nothing in .zshrc that I can see, anyway. I'm using zsh and oh-my-zsh. I tried removing the few oh-my-zsh plugins I had installed but, nothing changed.

I do have a bunch of aliases that I'm not sure where they are coming from. I checked .profile, .bashrc et al. (both in home and /etc too) and .zshrc (which I do use.) I'm currently trying to Google search a way to connect an alias to its file but, not having much luck.

-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'

I'll keep trying to figure it out.

@ljharb
Copy link
Member

ljharb commented Mar 21, 2019

Try type cd

@Natetronn
Copy link
Author

➜  ~ type cd
cd is a shell builtin

@ljharb
Copy link
Member

ljharb commented Mar 21, 2019

hmm, that’s very confusing. The cd -q error seems like something i can address, but that “reverting” output can’t be triggered by nvm.

@ljharb
Copy link
Member

ljharb commented Mar 21, 2019

I do see that nvm debug says that node is aliased to nodejs; that should be removed ASAP. Only ubuntu’s broken repository calls it nodejs.

@ljharb
Copy link
Member

ljharb commented Mar 21, 2019

I also see multiple copies of nvm’s dirs in your PATH (i also don’t know what linuxbrew is, but homebrew often causes issues with node and nvm).

@Natetronn
Copy link
Author

I removed linuxbrew. Going to install nvm again and see how it takes.

@Natetronn
Copy link
Author

Natetronn commented Mar 22, 2019

I removed yarn as well and the node alias to nodejs (I seem to remember that being some odd bug.) The PATH now looks more reasonable. So far, I'm not getting the cd error any longer and I didn't get any errors during nvm install.

I'll include nvm debug and nvm ls so you can see the difference.

What a weird error in that all things seemed to point to nvm itself.

Anyway, I'll see how I manage from here. Thanks again for your help!

➜  ~ nvm debug
nvm --version: v0.34.0
$SHELL: /usr/bin/zsh
$SHLVL: 1
$HOME: /home/nate
$NVM_DIR: '$HOME/.nvm'
$PATH: $NVM_DIR/versions/node/v10.15.3/bin:$HOME/bin:/usr/local/bin:$HOME/bin:/usr/local/bin:$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.4.2 (x86_64-ubuntu-linux-gnu)'
uname -a: 'Linux 4.18.0-16-generic #17~18.04.1-Ubuntu SMP Tue Feb 12 13:35:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux'
OS version: Ubuntu 18.04.2 LTS  
curl: /usr/bin/curl, curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
wget: /usr/bin/wget, GNU Wget 1.19.4 built on linux-gnu.
git: /usr/bin/git, git version 2.17.1
grep: grep: aliased to grep  --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}), grep (GNU grep) 3.1
awk: /usr/bin/awk, GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
sed: /bin/sed, sed (GNU sed) 4.4
cut: /usr/bin/cut, cut (GNU coreutils) 8.28
basename: /usr/bin/basename, basename (GNU coreutils) 8.28
rm: /bin/rm, rm (GNU coreutils) 8.28
mkdir: /bin/mkdir, mkdir (GNU coreutils) 8.28
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0-git
nvm current: v10.15.3
which node: $NVM_DIR/versions/node/v10.15.3/bin/node
which iojs: iojs not found
which npm: $NVM_DIR/versions/node/v10.15.3/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v10.15.3
npm root -g: $NVM_DIR/versions/node/v10.15.3/lib/node_modules
➜  ~ nvm ls
->     v10.15.3
default -> v10.15.3
node -> stable (-> v10.15.3) (default)
stable -> 10.15 (-> v10.15.3) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/dubnium (-> v10.15.3)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.0 (-> N/A)
lts/carbon -> v8.15.1 (-> N/A)
lts/dubnium -> v10.15.3

@ljharb ljharb closed this as completed Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs followup We need some info or action from whoever filed this issue/PR.
Projects
None yet
Development

No branches or pull requests

2 participants