Kualo / docs
On this page

Using the Node.js Selector for command-line scripts

Use cPanel's Node.js Selector to create a containerised Node.js environment for command-line scripts, build tools, and npm.

4 min read Updated 4 Jun 2026

If you need to run Node.js from the command line - for example, to install packages with npm, run build tools, or execute scripts - you might have already looked at our guide on using NVM to install Node.js. That method works well, but on servers with older operating systems, newer versions of Node.js may not function due to system library limitations.

In those cases there is an alternative: you can use the Node.js Selector in cPanel, which is normally used to run web apps, to create a containerised Node.js environment that also works perfectly for command-line tasks.

Although the Node.js Selector is designed to launch web-facing applications (as explained in our guide to creating web apps with Node.js Selector), it can also run non-web scripts - you simply create a dummy application and use a special command to enter its environment.

Step 1: Create a folder for your scripts

Create a directory in your home folder called node-scripts. Place it above public_html so your scripts are not accessible via the web, and are clearly separated from any website content.

This folder will hold all of your Node.js scripts, configuration files, and anything else related to your CLI-based Node.js work.

You can create the folder using:

  • File Manager in cPanel
  • FTP or SFTP
  • SSH with the command:
mkdir ~/node-scripts

Step 2: Create a dummy subdomain

The Node.js Selector requires each app to be associated with a domain or subdomain. This helps it set up the environment and configure web server routing - even if you are not actually serving a website.

Because we are only using this app for command-line tasks, create a throwaway subdomain such as cli.yourdomain.com. This is a workaround to satisfy the system's requirement for a domain link.

When you create the subdomain in cPanel, it automatically creates a document root folder (for example, /home/youruser/cli.domain.com). You can leave that folder completely empty.

During app setup you will manually specify your actual scripts folder - /home/youruser/node-scripts - so your CLI scripts remain private and are not exposed to the web.

Step 3: Create the Node.js app in cPanel

In cPanel, open Setup Node.js App and click Create Application. Configure it as follows:

  • Node.js version: select your desired version (for example, 20.x)
  • Application root: enter node-scripts (this maps to /home/youruser/node-scripts)
  • Application domain: select the dummy subdomain you created in step 2
  • Startup file: leave blank - cPanel will generate a placeholder you can ignore

Click Create. The app will start, even though nothing is being served to the web.

Step 4: Enter the virtual environment

Once the app is created, the app page displays a command similar to:

source /home/youruser/nodevenv/node-scripts/20/bin/activate && cd /home/youruser/node-scripts

This command does two things:

  • Loads the Node.js virtual environment for the version you selected
  • Changes directory into your node-scripts folder so you are ready to work

Connect to your account via SSH and run this command to enter the environment.

If SSH is not yet enabled on your account, contact our support team and we will be happy to turn it on. We use a non-standard SSH port and will provide the correct port number when access is granted.

Connect using an SSH client:

ssh [email protected] -p [port]

Replace [port] with the port number we provide.

Once connected, activate the Node.js virtual environment using the command from the cPanel UI:

source /home/youruser/nodevenv/node-scripts/20/bin/activate && cd /home/youruser/node-scripts

You can then confirm Node.js is available at the correct version:

node -v
v20.18.3

Limitations and considerations

This approach is ideal for CLI-based tasks such as:

  • Running build tools
  • Executing short-lived scripts
  • Managing dependencies with npm
  • Scheduling scripts via cron

You can also create multiple dummy apps if you want to use different Node.js versions for different projects.

There are a few important constraints to be aware of:

  • Custom ports are not available. You cannot run applications that bind to ports such as 3000 or 8080, as these are blocked for security reasons. For web-facing applications, use the Node.js Selector in cPanel, which integrates your app with the web server over standard ports.
  • Long-running or background processes are not allowed. Persistent scripts or daemons will be terminated automatically by the system. If you need recurring tasks, use cron jobs to run your scripts on a schedule.
  • Resource limits apply. All processes run within your account's CloudLinux resource limits, including CPU, memory, and disk I/O. Scripts that exceed these thresholds may be throttled or stopped.
Was this helpful?
Your feedback helps us find gaps in the docs.
Still need a hand?
Real people, around the clock - start a chat or open a ticket and we'll help you put it right.