Node.js : Install version management tool2026/06/16 |
|
Install Node.js version management tool [n] command. |
|
| [1] | |
| [2] | Install [n] command and upgrade Node.js. |
|
root@dlp:~# npm install -g n
added 1 package in 408ms # show the [stable] version root@dlp:~# n --stable 24.16.0 # show the [latest] version root@dlp:~# n --latest 26.3.0 # install the [stable] version root@dlp:~# n stable
installing : node-v24.16.0
mkdir : /usr/local/n/versions/node/24.16.0
fetch : https://nodejs.org/dist/v24.16.0/node-v24.16.0-linux-x64.tar.xz
copying : node/24.16.0
installed : v24.16.0 (with npm 11.13.0)
Note: the node command changed location and the old location may be remembered in your current shell.
old : /usr/bin/node
new : /usr/local/bin/node
If "node --version" shows the old version then start a new shell, or reset the location hash with:
hash -r (for bash, zsh, ash, dash, and ksh)
rehash (for csh and tcsh)
root@dlp:~#
/usr/local/bin/node -v v24.16.0 # install the [latest] version root@dlp:~# n latest
installing : node-v26.3.0
mkdir : /usr/local/n/versions/node/26.3.0
fetch : https://nodejs.org/dist/v26.3.0/node-v26.3.0-linux-x64.tar.xz
copying : node/26.3.0
installed : v26.3.0 (with npm 11.16.0)
root@dlp:~#
/usr/local/bin/node -v v26.3.0 # show installed versions root@dlp:~# n ls node/22.19.0 node/24.8.0 # switch to another version root@dlp:~# n node/22.19.0
copying : node/24.16.0
installed : v24.16.0 (with npm 11.13.0)
root@dlp:~#
/usr/local/bin/node -v v24.16.0 # deb package installed Node.js root@dlp:~# /usr/bin/node -v v22.22.1 |
| Sponsored Link |
|
|