How to create a Node.js application with cPanel using the Node.js Selector

The Node.js selector allows you to easily set up Node.js applications from the cPanel interface.

Step #1: Create the application

  1. Log in to cPanel.
  2. In the SOFTWARE section of the cPanel home screen, click "Setup Node.js App"
  3. On the Node.js selector page, click "CREATE APPLICATION" to start the application setup
  4. Fill in the fields on the application setup form:



    • Node.js version - select your preferred version from the drop-down list
    • Application mode - choose Development or Production from the list. Development may be chosen initially and changed to production later.
    • Application root - the file system location for 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 startup file - the initial file that will be processed when launching the application.
  5. After completing the form, click CREATE
  6. Your application will start automatically. Click on "OPEN" to view a test page

 

Step #2: Create the package.json file

To create the package.json file, follow these steps:

  1. In the FILES section of cPanel, click on "File Manager" to open the File Manager
  2. In the left-hand column of File Manager, click the text of the application root folder
  3. Click "+File" to create a new file
  4. In the New File dialog box, type the filename "package.json", and then click "Create New File"
  5. 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 appears
  6. In the Edit dialog box, click "OK"
  7. Type 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"
    }
  8. Click "Save Changes" to save the file
  9. Click "Close" to close the editor

 

Step #3: Install npm

  1. In the SOFTWARE section of the cPanel home screen, click "Setup Node.js" App
  2. In the "Actions" column of the Web Applications list, click the pencil icon to edit the application
  3. Click "Run NPM Install". A success indicator will be displayed when complete
  4. To install packages with NPM and do other command line tasks related to the application, log in via SSH and enter the virtual environment for the application using the command shown in the information box at the top of the application setup page

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Monitor the servers's status

This can be done in cPanel, in the left hand menu. Scroll to the bottom and find the link for...

What are my nameservers

Not sure what the names servers are for your website's domain name? Kindly refer to the welcome...

How do I add another domain to my Account?

All D-Tech shared Linux hosting plans allow you host multiple domains on the same account. To...

How Do I Create and Remove an Addon Domain?

An addon domain is a fully functional domain that can be created from within your control panel....

How do I manage my Shared hosting account?

We offer cPanel to manage your Shared Web Hosting account. You can learn more about cPanel here