Setting Up a Node.js App on cPanel

Node.js is a well-known open-source runtime environment that lets you make applications that run on the server. It is built on the V8 JavaScript engine and uses asynchronous I/O to handle requests quickly.

cPanel is a popular web hosting control panel that makes it easier to manage websites and gives you the tools you need to easily deploy Node.js apps.

This guide will teach you how to use cPanel to make and run a Node.js app.

Requirements

Check to see if you have before you start:

Step 1: Make a New App

  1. Sign in to your cPanel account.

  2. Click on Node.js App in the Software section.

  3. Give your app a name and choose a folder to keep it in.

  4. To start your Node.js app, click Create.

Step 2: Get NPM Packages

  1. Click Edit next to your app.

  2. Click Run NPM Install on the application page.

This installs all of the NPM packages that are listed in your app's package.json file.

Step 3: Make a package.json File (if you need it)

If your app doesn't already have a package.json file:

  1. Open File Manager in the Files section of cPanel.

  2. Go to the folder where your app is.

  3. Select New File by right-clicking.

  4. Give it the name package.json and open it in the editor.

  5. Put in the following text:

{ 
  "name": "my-application", 
  "version": "1.0.0", 
  "description": "My Node.js application", 
  "main": "index.js" 
}
  1. Keep the file.

Step 4: Open Your Application

In the Node.js App interface, click the Start button next to your app.

Your web browser can now access your application.

Conclusion

You have successfully set up a Node.js app on cPanel.

Make sure your NPM packages are up to date and check your application for updates often. Cyberin support is always available to help you if you have questions or problems.