ZoneOS platform servers default to the latest Node.js LTS (Long-term support) version. At the time of updating this article, it is version 20.12.1.
If you want to use another version of Node (older or newer), you will have to install the desired version on the virtual server itself.
In order to install, connect to the server via SSH. Learn more:
To install a specific version of Node, first install the Node version manager nvm
on the server.
To do this, enter the command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
After reconnecting to the server, it is possible to use the nvm
command.
You can check the version of Node.js currently running on the server with the command node -v
virtXXXXX:sn-69-51.tll07.zoneas.eu:~> node -v v20.12.1
If you want to install the latest available version of Node.js on the server, enter:
nvm install node
To install a specific version of Node.js, enter a command in the form:
nvm install 18.13.0
virtXXXXX:sn-69-51.tll07.zoneas.eu:~> nvm install 18.13.0 Downloading and installing node v18.13.0... Downloading https://nodejs.org/dist/v18.13.0/node-v18.13.0-linux-x64.tar.xz... ############################################################################################################### 100.0% Computing checksum with sha256sum Checksums matched! Now using node v18.13.0 (npm v8.19.3)
In case the application reverts to the old version of Node.js when restarting, the following commands should be used:
nvm use v18.13.0
node -v > .nvmrc
In order to see all possible Node.js versions, enter nvm ls-remote