Useful NVM commands · GitHub
Useful NVM commands · GitHub
chranderson / nvmCommands.js
Last active 13 hours ago
Code Revisions 2 Stars 717 Forks 199 Embed <script Download ZIP
nvmCommands.js
1 // check version
2 node -v || node --version
3
4 // list locally installed versions of node
5 nvm ls
6
7 // list remove available versions of node
8 nvm ls-remote
9
10 // install specific version of node
11 nvm install 18.16.1
12
13 // set default version of node
14 nvm alias default 18.16.1
15
16 // switch version of node
17 nvm use 20.5.1
18
19 // install latest LTS version of node (Long Term Support)
20 nvm install --lts
21
22 // install latest stable version of node
23 nvm install stable
// check version
node -v || node --version
Thanks buddy!!
Example:
nvm exec 4.8.3 node app.js Run node app.js with the PATH pointing to node 4.8.3
nvm alias default node Always default to the latest available node version on a shell
nvm set-colors cgYmW Set text colors to cyan, green, bold yellow, magenta, and white
Note:
to remove, delete, or uninstall nvm - just remove the $NVM_DIR folder (usually ~/.nvm )
Install Node
nvm ls-remote
nvm ls-remote | grep -i "latest"
nvm ls-remote | grep -i "<node_version>"
Set Alias
nvm alias default node // Always defaults to the latest available node version on a
shell
nvm alias default <node_version> // Set default node version on a shell
nvm alias <alias_name> <node_version> // Set user-defined alias to Node versions
nvm unalias <alias_name> // Deletes the alias named <alias_name>
nvm which <installed_node_version> // path to the executable where a specific Node version is
installed
Uninstall NVM
To remove, delete, or uninstall nvm, just remove the $NVM_DIR folder (usually ~/.nvm)
....but none of these are the command that shows the latest development version of node. So, I'm assuming that
in my ZSHRC I need to add a screen scrape of the home page to get the latest development version, then nvm
install it.
Thanks mate.
// check version
node -v || node --version
// list installed versions of node (via nvm)
nvm ls
great!
Install Node
nvm ls-remote
nvm ls-remote | grep -i "latest"
nvm ls-remote | grep -i "<node_version>"
Set Alias
nvm alias default node // Always defaults to the latest available node version
on a shell
nvm alias default <node_version> // Set default node version on a shell
nvm alias <alias_name> <node_version> // Set user-defined alias to Node versions
nvm which <installed_node_version> // path to the executable where a specific Node version
is installed
Uninstall NVM
To remove, delete, or uninstall nvm, just remove the $NVM_DIR folder (usually ~/.nvm)
Great!
So helpful!
Great !!
Nahidnawaz123 commented on Jul 4, 2023
$ node -v
v16.14.2
nvm install 8.0.0 Install a specific version number
nvm exec 4.8.3 node app.js Run node app.js with the PATH pointing to node 4.8.3
nvm alias default node Always default to the latest available node version on a shell
nvm set-colors cgYmW Set text colors to cyan, green, bold yellow, magenta, and white
example: nvm install --lts=gallium (to install the lts for major version 16)
# install last LTS version and install global packages from "current" node version.
# run "nvm list" to see if you have "current" alias and which version points to
nvm install --lts --reinstall-packages-from=current
# install specific version and install global packages from specific version
nvm install 20.0.0 --reinstall-packages-from=18
Thank you 🙏
gedharizka commented on Jan 31
nvm alias default 18.19.0 command is not changing the default node version on wsl.
nvm -v is 0.39.7 . I have installed node version 14 and v18 via nvm. The nvm alias default command does
not change the node version and only defaults to v14. However, the command nvm use default 18.19.0 is
working but when restarting WSL it falls back to v14.21.3 .
nvm -v is 0.39.7 . I have installed node version 14 and v18 via nvm. The nvm alias default command
does not change the node version and only defaults to v14. However, the command nvm use default
18.19.0 is working but when restarting WSL it falls back to v14.21.3 .
From the screenshot your machine load node 18 and not node14, so it seem that is resolved. Is it the case ??
It changes the node version but after closing the terminal or vs code, it reverts to node v14. The nvm alias
default command is not working on WSL.
It changes the node version but after closing the terminal or vs code, it reverts to node v14. The nvm
alias default command is not working on WSL.