Skip to content
Your Hosting Ad Goes Here KBAssets

How To Set Up Node.Js Application In cPanel

In this tutorial, you will learn you to easily set up Node.js applications with the cPanel graphical interface.

Create The Application

1) Log in to cPanel.
2) In the SOFTWARE section of cPanel, click on the Setup Node.js App icon


3) On the Node.js selector page, click on the Create Application button to start the application setup.

Fill in the required fields on the application setup form.

  • Node.js version – select your preferred Node.js version from the drop-down list.
    The supported versions are 8.17.0, 9.11.2, 10.24.1, 11.15.0, 12.22.9, 14.20.1,16.17.1, 18.14.1 and 20.10.0
  • Application mode – choose Development or Production from the drop-down list. You can choose Development initially and change it to Production later on.
  • Application root – the file system location for the application files. The entry will be appended to /home/username to form the complete path to the application files in the cPanel home directory.
  • Application URL – the public URL to your application.
  • Application startup file – the initial file that will be processed when launching the application.

4) When the form is complete, click the Create button.

5) After the application is created, an information box is displayed advising that the package.json is required to continue.

The application will launch and display a test page. If you want to see if the test page works, Click the Open button.

6) Click the Cancel button to continue.

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.

Create The Package JSON

1) Go back to cPanel’s dashboard. In the FILES section of cPanel, click the File Manager icon to open the File Manager.

2) In the left-hand column of File Manager, click the text of the application root folder.

3) Click the +File button to create a new file.

In the New File dialog box, enter the file name package.json and then click the Create New File button.

4) Once the file is created, Right-click or secondary click on the package.json file in the right-hand column of File Manager and then click Edit. An edit dialog box is displayed.

5) In the Edit dialog box, click the OK button and enter the following text in the editor screen

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

6) Click the Save Changes button to save the file.

7) Click the Close button to close the editor.

Install NPM

1) In the SOFTWARE section of cPanel, click on the Setup Node.js App icon

2) In the Actions column of the Web Applications list, click the pencil icon to edit the application.

3) Click the Run NPM Install button.

The NPM installation runs and presents a success indicator when completed:

Node.js
NPM Install completed successfully

Was this article helpful?
YesNo
Back To Top