fnm
fnm copied to clipboard
Feature: Add a command like nvm install node
First of all, just wanted to say thanks, the speed difference between this and nvm is insane 😄
Feature request
Could we get a command similar to nvm install node
to install the latest version of node?
nvm default node
, nvm use node
are also really useful to stay up to date with the latest.
I have scripts that automatically update the default node version for use with some global packages that have to be global.
Greetings, do you want to install latest, or latest LTS version? (the latter is what I generally recommend)
Yes it the latest I am after.
I normally like to get the latest node to test against and check for compatibility of some apps etc as soon as new versions are available.
I have a script I run periodically to update node and other things. It just makes it simpler to always get latest than to run the list command manually every now and then, or use grep of course 😉
I'd also recommend LTS for production, however, in development most of us tend to use the latest stable version instead, in order to find and fix breaking changes early.
Something like this should work (tested on MacOS):
V=$(fnm ls-remote | sort -V | tail -n 1 | tr -d '\n') && fnm install $V && fnm default $V
Something like this should work (tested on MacOS):
V=$(fnm ls-remote | sort -V | tail -n 1 | tr -d '\n') && fnm install $V && fnm default $V
Thanks, I ended up with something similar.
This gives the latest major version number, then I let the install command handle installing latest minor via sem version.
fnm ls-remote | cut -d "." -f1 | cut -d "v" -f2 | tail -1
I also grab any global packages so they can be reinstalled after upgrade of node.
npm ls -g | cut -d "@" -f1 | cut -d " " -f2 | tail -n +2 | tr "\n" " " | awk '{$1=$1};1'
I am sure both those could be improved, but they work 🤷🏻♂️