HostingDomainsEmailSSLPricingSupport
Dashboard
πŸ“– Knowledge Base

How Can We
Help You?

Browse guides, tutorials and troubleshooting articles for all our services.

How to Enable Node.js and Install npm Modules in Enhance Hosting

1. Enable Node.js for Your Website

This guide explains how to enable Node.js for your website and how to install npm modules inside your isolated Node.js container using SSH.

  1. Log in to your hosting control panel.
  2. Go to Websites and select your domain.
  3. Open the Node.js App section.
  4. Click Create Node.js App.
  5. Configure:
    • Port (auto‑assigned or custom)
    • Startup command (e.g., node app.js)
    • Node.js version (Stable recommended)
    • Working directory (Home directory)
    • Start mode (Automatic)
  6. Save your settings.

Your website now has its own isolated Node.js container. The log panel will show the startup process.


2. Access Your Node.js Container via SSH

To install npm modules, you must log in directly to your website’s container. This is done through the SSH settings shown in your control panel.

Open the SSH Access Panel

In your website dashboard, go to:

Websites β†’ Advanced β†’ SSH Key Manager / SSH Password Authentication

Option A: Log in using an SSH Key (recommended)

  • Click Upload Public Key in the SSH Key Manager.
  • Add your SSH public key.
  • Use the SSH command shown in the panel to connect.

Option B: Log in using SSH Password Authentication

  • Enable SSH password authentication.
  • Copy the SSH login command shown in the panel.
  • Use your SSH password to log in.

Once logged in, you are inside your website’s Node.js container.


3. Initialise Your Node Environment (REQUIRED BEFORE ANY NPM COMMANDS)

Before installing npm modules, you must initialise Node.js and NVM inside the container by running:

/usr/bin/install_nvm_and_node.sh

Then load NVM into your current shell session:

export NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh"

4. Navigate to Your Application Directory

ls -la

You should see files such as:

  • app.js
  • package.json
  • package-lock.json
  • node_modules (if already installed)
  • public_html

If your app is inside a subfolder:

cd foldername

5. Install npm Modules

All npm installations must be done inside your container after running the initialization script and loading NVM.

Install all dependencies from package.json:

npm install

Install a specific module:

npm install express

Install multiple modules:

npm install express axios dotenv

6. Restarting Your Node.js Application

You can restart your Node.js application directly via SSH using:

pkill -f "node.*src/server"

Or restart the entire container:

  1. Go to Websites β†’ Node.js App.
  2. Click Delete App.
  3. Create the app again with the same settings.

This forces the container to rebuild and restart with your latest code and modules.


7. Common Issues & Fixes

Error: Cannot find module 'express'

Modules were not installed inside the container or Node was not initialised.

/usr/bin/install_nvm_and_node.sh
export NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh"
npm install express

App not updating after changes

Restart using:

pkill -f "node.*src/server"

Or recreate the Node.js app in the control panel.

Can't Find What You're Looking For?

Our support team is available 24/7 to help. Open a ticket and we'll get back to you as soon as possible.