jorgebucaran / nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
https://git.io/nvm.fish
MIT License
2.08k stars 69 forks source link

nvm does not remember selected version when I restart the terminal #169

Closed qstyler closed 2 years ago

qstyler commented 2 years ago

Hi! I'm using fish and nvm for the node.js version management.

When I look at the node version I get this:

➜  ~ node --version
v15.14.0
➜  ~ which node
/Users/xxx/.nvm/versions/node/v15.14.0/bin/node

Then I try to install the LTS node, and the same is with use

➜  ~ nvm install lts
Now using Node v15.14.0 (npm 7.21.1) ~/.nvm/versions/node/v15.14.0/bin/node
➜  ~ nvm use lts
Now using Node v15.14.0 (npm 7.21.1) ~/.nvm/versions/node/v15.14.0/bin/node

nvm list and current gives me this:

➜  ~ nvm list
     system
 ▶ v16.13.2 lts/gallium
➜  ~ nvm current
v16.13.2
jorgebucaran commented 2 years ago

Did you set nvm_default_version?

qstyler commented 2 years ago

@jorgebucaran yes I did.

set --universal nvm_default_version v16.13.2

I can do this:

➜  ~ nvm list
->     v15.14.0
        v16.6.2
       v16.13.1
       v16.13.2
         system
default -> v15 (-> v15.14.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.13.2) (default)
stable -> 16.13 (-> v16.13.2) (default)
lts/* -> lts/gallium (-> v16.13.2)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.10 (-> N/A)
lts/fermium -> v14.19.0 (-> N/A)
lts/gallium -> v16.13.2

➜  ~ nvm use lts
N/A: version "lts -> N/A" is not yet installed.
You need to run "nvm install lts" to install it before using it.

➜  ~ nvm use v16.13.2
Now using node v16.13.2 (npm v8.1.2)

➜  ~ node --version
v16.13.2

This will get the specific version that I have to manually type in

but if I quit the shell and start it again it's going to default to v15

➜  ~ node --version
v15.14.0
jorgebucaran commented 2 years ago

Are you using POSIX nvm or nvm.fish?

qstyler commented 2 years ago

It turns out that I indeed had ~/.nvm folder from old times.