> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrating an existing application from Node.js Selector to a manual installation

> This article describes how to migrate an existing Node.js application from the Node.js Selector in cPanel to a manual Node.js installation.

This article describes how to migrate an existing Node.js application from the Node.js Selector in cPanel to a manual Node.js installation.

You may need to do this when migrating from a shared, reseller, or Turbo account to a hosting package that does not include the Node.js Selector in cPanel (such as an unmanaged VPS).

## Migrating an application

In most cases, Node.js applications can be migrated from Node.js Selector with only minor modifications. To do this, follow these steps:

1. To create the new Node.js application manually, type the following commands:

   ```bash theme={null}
   mkdir ~/myapp
   cd ~/myapp
   npm init -y
   ```

   > 📘 Note
   >
   > * For unmanaged hosting packages, you may need to install the Node.js and npm packages first. Consult the documentation for your installed Linux distribution for information about how to do this.
   >
   > * You do not have to use the directory name *myapp*. You can name the directory anything you want.

2. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

3. On the **Tools** page, in the **Software** section, click **Setup Node.js App**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-software-setup-nodejs-app-icon.png)

4. Under **WEB APPLICATIONS**, in the **App Root Directory** column, note the path for the application's root directory.

5. Copy the files in the application's root directory to the new application location that you created in step 1 (in our example, this is *\~/myapp* ).

6. Modify the application files for the new application environment as follows:

   * **Port number**: Applications created by the Node.js Selector obtain port numbers dynamically. For a manual installation, you probably want to assign a specific port number to the application. The exact procedure to do this depends on the code in your application. For example, the following Express Node.js code demonstrates how to use a hard-coded port number of **3000**:

     ```javascript theme={null}
     const express = require('express')
     const app = express()
     const port = 3000

     app.get('/myapp', (req, res) => res.send('Hello World!'))

     app.listen(port, () => console.log('Example app listening at http://localhost:${port}'))
     ```

   * **Routes:** You may have to modify the routes in your application code. This is because applications created by the Node.js Selector use the value specified in the **Application URL** text box to create the root path. For example, if the **Application URL** text box in Node.js Selector is set to *myapp*, then the root path for the application is not "*/*" but "*/myapp*". However, for Node.js applications created outside of the Node.js Selector environment, "*/*" is typically the root path.

7. Start the application in Node.js and confirm everything is working correctly.

## Related articles

* [Connecting to MySQL using Node.js](/docs/connecting-to-mysql-using-node-js)

* [Creating a Node.js application with cPanel using the Node.js Selector](/docs/create-application-with-nodejs-selector)

* [Installing and configure Node.js on managed hosting](/docs/installing-and-configuring-nodejs-on-managed-hosting)

* [Creating persistent Node.js applications](/docs/making-persistent-node-js-applications)

* [Migrating a Node.js application to Node.js Selector](/docs/migrating-a-node-js-application-to-node-js-selector)

* [Node.js application error message: "Cannot GET" URL](/docs/node-js-application-error-message-cannot-get-url)
