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

## Some Definitions:

`You should change these values to match the values required for your account and application.`

- **app:** is used as an example for the application root directory and application uri

- **example:** is used as example for the username

- **example.com** is to illustrate the domain

- **app.js** is used as example for the application startup file

- **My app** will be used as the description

- **10 or 11** are the node.js versions

## Setting up the NodeJs app:

To set up a Node.js application using cPanel, follow the steps below.

### Step 1 - Create the application:

1. First, you need to login to cPanel.

For help in accessing cPanel, click on this [Link](https://dash.wevrlabs.net/knowledgebase/2/How-to-access-cPanel.html)

2. In the **SOFTWARE** section of cPanel, click the **Setup Node.js App** icon to open the Node.js selector:

![](https://dash.wevrlabs.net/images/kb/19_cpanel-setup-node-app.jpg)

3. On the Node.js selector page, click **CREATE APPLICATION** to start the application setup:

![](https://dash.wevrlabs.net/images/kb/20_cpanel-node-create-application-button.png)

4. Fill in the fields on the application setup form:

![](https://dash.wevrlabs.net/images/kb/21_cpanel-node-application-settings.png)

- **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.

Typical locations for the application root are `/home/username/appname` or `/home/username/apps/appname`. Do not put the application root inside the domain document root.

- **Application URL:** the address of the application to be accessible from the Internet.

When you define routes in your application code, you must include the application URL in the route.

- **Application startup file:** the initial file that will be processed when launching the application.

5. When you're happy with your settings. click on **CREATE**:

![](https://dash.wevrlabs.net/images/kb/22_cpanel-node-create-button.jpg)

6. The app should start automatically if you setup everything correctly. Click on **OPEN** to view the test page.

### Step 2 - Create the package.json file:

Follow these steps to create the `package.json` file:

1.from cPanel open the **File Manager**:

![](https://dash.wevrlabs.net/images/kb/23_cpanel-cpanel-78-file-manager-icon.jpg)

2. From the directory tree on the left, find and click on the application root folder (you should have already specified this in the steps above):

![](https://dash.wevrlabs.net/images/kb/24_cpanel-node-app-folder.png)

3. Find and click `+File` icon to create a new file:

![](https://dash.wevrlabs.net/images/kb/25_cpanel-78-file-manager-new-file.png)

4. In the **New Filedialog** box, type the filename `package.json`, and then click **Create New File**:

![](https://dash.wevrlabs.net/images/kb/26_cpanel-node-new-file-packagejson.png)

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 may appear (click OK to proceed to the Editor):

![](https://dash.wevrlabs.net/images/kb/27_cpanel-node-packagejson-edit.jpg)

6. In the **Editor** screen, you should have something like the example below in the `package.json` file (modify according to your app):

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

7. Click **Save Changes** to save the file:

![](https://dash.wevrlabs.net/images/kb/28_kb-cpanel-filemanager-savechanges-button.jpg)

8. Click **Close** to close the editor.

### Step 3 - Installing npm:

1. In the **SOFTWARE** section of cPanel, click on the **Setup Node.js App** icon to open the Node.js selector:

![https://dash.wevrlabs.net/images/kb/19_cpanel-setup-node-app.jpg](https://dash.wevrlabs.net/images/kb/19_cpanel-setup-node-app.jpg)

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

![](https://dash.wevrlabs.net/images/kb/29_cpanel-node-edit-application-button.jpg)

3. Click **Run NPM Install**:

![](https://dash.wevrlabs.net/images/kb/30_cpanel-node-install-npm-button.jpg)

4. The NPM installation runs and displays a success indicator if you have everything setup correctly:

![](https://dash.wevrlabs.net/images/kb/31_cpanel-node-npm-success.jpg)