How to Set up Node.js Application in cPanel?

How to Set up Node.js Application in cPanel?

Node.js is an open-source and cross-platform JavaScript runtime environment. In this blog I will show you how to Set up Node.js Application in cPanel. It was released in 2009 by Ryan Dahl. Node.js is not dependent on any operating system software. It can work on Linux, macOS, or Windows. Node.js allows you to write JavaScript on both client and server.

The NPM library is one of the excellent resources that comes with Node.js. The library contains a registry of over a million packages.

On our Business hosting with cPanel you are able to deploy Node.js and Python core apps via cloudlinux application manage. Node.js Selector is a feature that allows you to deploy Node.js applications on cPanel.

Create the Application to Set up Node.js Application in cPanel

First, you need to create an application. To do this, follow these steps:

STEP 1: Login to cPanel.

STEP 2: Go to the software section of cPanel, and there you will find the Setup Node.js App. Click on that.

Set up Node.js Application in cPanel

STEP 3: Under the Node.js option, you will see “Create Application.” Click on that.

Create Application

STEP 4: Here you have to fill in the details of the Node.js application setup.

Nodejs application setup

Node.js version: Select your preferred Node.js version, you can changed it later.

Application mode: You can choose either Development or Production mode from the list. You can select Development at first and then switch to Production later. 

Application root: The path to your application where you upload your application files.

Application URL: The Web address of your application.

Application startup file: This will be the initial file that will run as the application opens.

STEP 5: When the form is complete, click the Create button.

STEP 6: Click on “Open” for you to see a test version, and as you can see, it is successfully open with a message of “It works.”

opening application to see a result

Now that a working application is installed, the environment can be enhanced with the package.json settings file and the npm package manager. To install package.json and npm, follow the steps in the next two sections.

Creating the package JSON

STEP 1: Go back to your cPanel homepage.

STEP 2: Go to the Files section, click on File Manager, and there, on the left side, you can see the nodeapp that you have created.

creating file

STEP 3: Now create a package.json file .

creating package.json file

STEP 4: After that we have to Edit that package.json file.

Editing package.json file

STEP 5: On the Editor screen, type in the following and click on Save, and then Close it.

  "name": "nodeapp",
  "version": "1.0.0",
  "description": "My App",
  "main": "nodeapp.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "author": "",
  "license": "ISC"
Editing code in package.json file

Install npm

STEP 1: Once again, go to your cPanel homepage and click on Setup Node.js App.

STEP 2: Click on Edit the application.

Editing the application

STEP 3: Click on Run NPM Install.

Opening the Application URL

STEP 4: You should receive a Message saying that the NPM install has been completed successfully.

NPM install completed sucessfully

On the application setup page, you can choose to “Enter the virtual environment” where you can add and install packages with NPM through SSH login. This command should be visible in the information box within the application setup page.

Leave a Reply

Your email address will not be published. Required fields are marked *