How to Set Up Node.js for Command-Line Use using NVM
Knowledgebase Article
}
Knowledgebase Article
Node.js is a versatile JavaScript runtime with many uses. It can power modern websites and APIs, run command-line tools, automate tasks, or support development workflows using utilities like Webpack, ESLint or Prettier.
If you're hosting with Kualo and want to use Node.js inside your cPanel account, the good news is that you can. The setup you need depends on how you plan to use Node.js.
There are two main methods available:
We’ll show you how to install your own version of Node.js using NVM (Node Version Manager) so you're not restricted to the default system version that cPanel provides.
SSH access is required to install Node.js manually. If SSH is not yet enabled on your account, please contact our support team and we’ll be happy to turn it on.
Once enabled, connect using an SSH client like this:
ssh youruser@yourdomain.com -p [port]
Replace [port]
with the port number we give you.
When you connect via SSH, you may notice that a version of Node.js is already installed:
$ node -v
v16.15.0
This version is globally installed on the server by cPanel. It’s shared across accounts and may be older because it’s tied to server-wide applications. You cannot upgrade this system version—but thanks to CloudLinux, you can install your own copy inside your account using NVM.
NVM allows you to install and manage different versions of Node.js within your hosting account. It works entirely in your user space and doesn't require root access.
To install NVM, you should always use the official installation instructions to ensure you're using the latest supported version.
You can find the latest install command here:
👉 https://github.com/nvm-sh/nvm#installing-and-updating
At the time of writing, the command looks like this:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Once the install finishes, you should see confirmation that NVM was installed and configured. The installer automatically adds the required setup lines to your .bashrc
file so that when you next connect to SSH, NVM should be available.
However, to start using NVM straight away without reconnecting, you can run these two lines:
export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh"
Now that NVM is ready, you can install your desired version of Node.js. To see all available versions you can run:
nvm ls-remote
To install the latest LTS (Long-Term Support) version:
nvm install --lts
Or install a specific version, e.g.:
nvm install 18.19.0
Once installed, the latest LTS version will be activated automatically and set as your default Node.js version.
You can verify it worked:
node -v
npm -v
Many servers now run CloudLinux 8 or 9, which support all modern Node.js versions, but if your account or server is running on an older operating system and you attempt to use a modern version of Node.js, you may see errors.
If this happens, you have three options:
We’ll be happy to review your hosting environment and help ensure compatibility with the version you need.
While you can now run Node.js from the command line, please be aware of the following limitations in a shared hosting environment:
npm install -g
, it is only available within the currently active version set by NVM. Switching Node.js versions may require you to reinstall global packages under the new version.Powered by WHMCompleteSolution