nvm icon indicating copy to clipboard operation
nvm copied to clipboard

NVM doesn't know the installed lts version is outdated.

Open avin-kavish opened this issue 2 years ago • 7 comments
trafficstars

$ nvm use --lts
Now using node v16.17.0 (npm v8.15.0)

$ nvm install --lts
Installing latest LTS version.
Downloading and installing node v18.18.0...
Downloading https://nodejs.org/dist/v18.18.0/node-v18.18.0-linux-x64.tar.xz...
############################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v18.18.0 (npm v9.8.1)

I typed nvm use while node 16 was installed as the lts version. It used 16 without actually checking whether it was the current LTS version. Would be good if it did the check.

avin-kavish avatar Sep 19 '23 10:09 avin-kavish

It's actually a very good thing it doesn't, because nvm use shouldn't ever make a network call.

I agree that trying to install --lts when the local machine resolves that to 16.17, and getting "not that", is a bug. However, the local machine not updating its local LTS mapping until a network call is made is quite intentional.

ljharb avatar Sep 19 '23 23:09 ljharb

hmm, thinking about this more. if you wanted to stay on the LTS line, you'd have done nvm install --lts=gallium. by asking for --lts, you're explicitly asking for the latest possible LTS thing.

I could certainly add some warning output when the version you may have expected to get has, due to server updates, changed - would that help?

ljharb avatar Sep 20 '23 18:09 ljharb

yeah, I think.

Also this might be a bit more advanced, don't know if it's possible - it could check the LTS expiry date from a local lookup table. I think these dates are set in advance so it could cache a table from the last network call.

avin-kavish avatar Sep 21 '23 14:09 avin-kavish

I’m intentionally not going to make anything time-based in nvm; those dates change, and system clocks aren’t always correct, and EOL status doesn’t change what version of node you need.

ljharb avatar Sep 21 '23 14:09 ljharb

Right, I think in that case just a notice would work - using "latest locally installed lts version" or similar...

avin-kavish avatar Sep 25 '23 05:09 avin-kavish

For my usecase, I'd like to be able to ensure that my build is always installing the latest version from the lts/iron line. Should I run nvm clear cache before doing a nvm install lts/iron?

unlikelyzero avatar Mar 26 '24 04:03 unlikelyzero

@unlikelyzero no need; the install command will always get the latest version. The cache doesn’t prevent version listing, it only stores binaries and source.

ljharb avatar Mar 26 '24 14:03 ljharb