> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://helpdesk.gbnetwork.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to Set Up Node.js Application in cPanel Hosting?


### What is Node.js?

Node.js is a powerful, open-source JavaScript runtime built on Chrome's V8 engine that allows you to run JavaScript on the server side. It’s widely used for building fast, scalable web applications, real-time systems like chat apps, APIs, and dynamic websites.

At GB Network Solutions, we’re always focused on giving developers, startups, and business owners the flexibility to run their web applications with ease. If you're building modern web apps, APIs, or real-time systems using Node.js, you’ll be glad to know that our hosting environment supports Node.js.

### Benefits of Hosting Node.js

* **Easy Setup via cPanel** – No command-line experience needed.
* **Multiple Versions Supported** – Choose the version that matches your app.
* **Flexible App Management** – Quickly restart, update, or debug your app from the browser.
* **npm Support** – Easily install your project dependencies.
* **Great for Modern Web Apps** – Ideal for Express, Next.js, APIs, and more.

### Prerequisites

Before you begin:
* You are using Startup or Business Web Hosting plans (cPanel and Node.js are included by default) or Linux KVM VPS / Dedicated Server plan with cPanel and CloudLinux added as an addon.
* You have already created a domain or subdomain in your cPanel account. If you plan to deploy your Node.js application on your **main domain**, you can proceed with the setup as usual. However, if you intend to deploy your app on an **addon domain** or **subdomain**, please make sure the domain has been properly created in cPanel beforehand. Please refer to our step-by-step guide: [How To Add An Addon Domain In cPanel](https://helpdesk.gbnetwork.com/en/article/how-to-add-an-addon-domain-in-cpanel-uvzzoy/) and [How To Create a Subdomain in cPanel](https://helpdesk.gbnetwork.com/en/article/how-to-create-a-subdomain-1ciw4en/).
* Your Node.js application files are uploaded to your hosting account.

### Step-by-Step: Set Up Node.js in cPanel

1. Login into your cPanel using the username and password provided. You can retrieve your cPanel credentials from your registered email once you have subscribed to our plans.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_4qdi06.png)
2. Inside cPanel, scroll down to the **Software** section and click **“Setup Node.js App”.**
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1taj8rc.png)
3. Click **“Create Application”**.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1rbe91x.png)
4. Configure the following:
* **Node.js Version** – Select your required version (e.g., 22.x). Choose the latest stable version unless your app requires something specific.
* **Application Mode** – Set this to **Production** for live environments or **Development** if you’re still testing or debugging the application.
* **Application Root** – The **Application Root** is the **file system location** for your app’s files. This path is relative to your cPanel home directory, usually `/home/username/`.  For example:
* If you enter `myapp`, your full path becomes `/home/username/myapp`
* If you enter `apps/myapp`, the full path becomes `/home/username/apps/myapp`

||| Important: Do not place the application root inside the document root of your domain (like public_html). This can lead to permission conflicts or unexpected behavior. Instead, keep it separate to maintain a clean environment for both your web files and your Node.js app.
* **Application URL** – Choose the domain or subdomain where you want your Node.js app to be accessible. This connects the selected domain/subdomain to your application root. For example, If you chose `myapp` as the application root and selected `app.yourdomain.com` as the URL, accessing `https://app.yourdomain.com` will load your Node.js app from `/home/username/myapp`.
* **Application Startup File** – This is the main file that runs your Node.js app. Common names include `app.js`, `index.js` or `server.js`
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_f1myxv.png)
5. Click **"Create"** to finish.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1dzfsq9.png)
6. The application will start automatically. To verify that it's running correctly, click **“OPEN”** to view the default test page in your browser.

![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_r9k76.png)
7. If the application is set up successfully, you’ll see a message that says: **“It works!”** displayed on the page.

![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_f6hjrw.png)
Now that a working application is installed, you can customize and manage your app environment using the `package.json` file along with the `npm` package manager.

###### Choose Your Setup Path:
* [I already have a Node.js app developed and ready to deploy](#6-if-you-already-have-a-nodejs-app-developed)
* [I want to start a Node.js app from scratch on the server](#6-if-youre-starting-a-nodejs-app-from-scratch)

###### If You Already Have a Node.js App Developed

Follow these steps if you’ve already built and tested your Node.js app on your local machine:

1. Use File Manager to upload all your app files including:
 
* `package.json`
* `.env`
* Any required folders and files

2. Upload them to the folder you set as your **Application Root** during app creation. Access your cPanel using the credentials provided by GB Network Solutions.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1lsktir.png)
3. Inside cPanel, scroll down to the **Files** section and click **“File Manager”. **A new tab or window will open, displaying your hosting file structure.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1qp2roc.png)
4. In the left sidebar of File Manager, go to the directory you set as your **Application Root** during the Node.js app setup.
The **Application Root** is the **file system location** for your app’s files. This path is relative to your cPanel home directory, 
 usually `/home/username/`.  For example:
* If you entered `myapp` as the Application Root, your full path becomes `/home/username/myapp`
* If you entered `apps/myapp`, the full path becomes `/home/username/apps/myapp`
   You may refer to [this section - Step 4](#3-step-by-step-set-up-nodejs-in-cpanel) if you are unsure your current **Application Root**.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_12rsaij.png)
5. Click the **Upload** button in the top menu.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_4xu2s5.png)
6. In the upload page, click **Select File** or drag-and-drop files from your computer and upload the following:
* `package.json`
* `.env` (if you use environment variables)
* All your app files (e.g., `app.js`, `server.js`, folders like `routes`, `public`, `views`, etc.)
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1hlpooz.png)
Once uploaded, click **Go Back to “/home/username/myapp”** to return to File Manager.
7. (Optional) If you uploaded a `.zip` file containing your app, right-click the `.zip` file.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1y733n2.png). Select **Extract** and choose the current directory.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_2injox.png)
Now that you've uploaded and extracted your application files, the next step is to install the required Node.js dependencies. Proceed to the [Install NPM Packages](#3-install-the-npm-packages) section to complete this part of the setup. This will ensure all the necessary modules listed in your `package.json` are properly installed within your hosting environment.

###### If You’re Starting a Node.js App From Scratch

Follow these steps if you haven't built your Node.js app yet and want to start directly on your hosting account using cPanel’s File Manager. 

1. Access your cPanel using the credentials provided by GB Network Solutions.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_tr564o.png)
2. Inside cPanel, scroll down to the **Files** section and click **“File Manager”. **A new tab or window will open, displaying your hosting file structure.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_gitn7u.png)
3. In the left sidebar of File Manager, go to the directory you set as your **Application Root** during the Node.js app setup.
The **Application Root** is the **file system location** for your app’s files. This path is relative to your cPanel home directory, 
 usually `/home/username/`.  For example:
* If you entered `myapp` as the Application Root, your full path becomes `/home/username/myapp`
* If you entered `apps/myapp`, the full path becomes `/home/username/apps/myapp`
 You may refer to [this section - Step 4](#3-step-by-step-set-up-nodejs-in-cpanel) if you are unsure your current **Application Root**.

![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1i84c4a.png)
4. To begin, click the **+ File** button located in the top-left corner of File Manager.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_nc0bsv.png)
5. When the dialog box appears, enter the filename as `package.json` and then click **Create New File**.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1me4j3x.png)
6. Next, find the newly created `package.json` file in the file list. Right-click on the file and choose **Edit**. A confirmation dialog will appear — click **Edit** to proceed to the editor.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1ux1u31.png). Now we need to enter the content in the file editor.

The `package.json` file is the **core configuration file** for any Node.js application. It defines important details about your app, including:

* **App metadata** – name, version, description, and author
* **Main file** – the JavaScript file your app runs from (e.g., `app.js`, `index.js`, or `server.js`)
* **Scripts** – commands you can run using `npm`, like starting the app or running tests
* **Dependencies** – packages your app needs to work, such as Express or Mongoose
Even for simple apps, `package.json` helps you manage your project structure and is required to install packages via `npm`
Here’s an example of a basic `package.json` structure:

```
{
  "name": "app",
  "version": "1.0.0",
  "description": "My App",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}   
```

|| You can change values such as "name", "description", or "main" based on how your app is structured. This is just a starting point — more advanced apps may include additional fields or dependencies later.

![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_10nymzz.png)
8. Once you've added the content, click **Save Changes** at the top-right corner, and then click **Close** to exit the editor.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_qwyhtp.png)ow that you’ve created the package.json file, the next step is to install the required Node.js dependencies. Proceed to the [Install NPM Packages](#3-install-the-npm-packages) section to complete this part of the setup. This will ensure all the necessary modules listed in your `package.json` are properly installed within your hosting environment.  

### Install the NPM Packages

1. Go back to the **Node.js App** section in cPanel.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_13us1rh.png)
2. Click **Edit** next to your app.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_bz761w.png)
3. Click **“Run NPM Install”** to install dependencies from your `package.json`.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_bsm4rk.png)
4. Once the process is complete, you will see a message **NPM Install completed successfully**. This indicates that all required packages have been installed into your application environment.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_6nceys.png)
5. After clicking **Run NPM Install**, your application’s dependencies will be installed. Once you see the message that **NPM Install completed successfully**, you can continue with additional setup steps, including create and configure the `.env` file. This file is where you’ll store sensitive configuration variables (e.g., API keys, database credentials) that your app can access securely. Depending on your app, you might need to configure other settings, like database connections, server configurations, or third-party services.

6. Now that your Node.js app is up and running, it’s important to know how to manage it effectively.
* **Restart the Application:** If you make changes to your code or need to apply configuration updates, you can restart the application by clicking the **Restart** button in the Node.js Selector interface.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1msin8l.png)

* **Change Node.js Version:** If you need to use a different version of Node.js, you can easily do so. Just stop your app, select a new version from the **Node.js Selector **and **Save**, and restart the app to apply the new version.
![](https://storage.crisp.chat/users/helpdesk/website/-/6/7/9/3/67938060e89a4400/image_1g404yo.png)
Setting up a Node.js application in cPanel is simple once you understand the flow — from preparing your hosting environment to deploying your app, installing dependencies, and managing your runtime settings. Whether you're deploying an app you’ve developed locally or building one from scratch directly on the server, our hosting provides a flexible interface to get started quickly.

By following this guide, you should now have a running Node.js app on your domain or subdomain. You’ve also learned how to manage it and update dependencies, giving you full control over your application hosting environment.

---

### Need Further Assistance?

If you face any issues or need assistance, don’t hesitate to reach out — **our support team is always ready to help!**

🔧 **Need help?** [**Submit a Support Ticket**](https://secure.gbnetwork.com/submitticket.php)  
💬 **Chat with us on Live Chat via our** [**website**](https://www.gbnetwork.my/)