//Web Panel

Run pnpm & Build Static Sites with Plesk Node.js Extension

Learn how to install pnpm on a Plesk server, set up a Node.js app and build static sites with Next.js, Gatsby or Vite—all via Plesk.

5 min read
Run pnpm & Build Static Sites with Plesk Node.js Extension

Deploying modern JavaScript applications on a Plesk-managed server is straightforward thanks to the built-in Node.js extension. While npm is the default, pnpm offers faster installs and a more efficient disk layout—an advantage on shared or VPS environments. This guide walks you through installing pnpm, configuring a Node.js application, and building a static site (for example with Next.js, Gatsby, or Vite) directly from the Plesk control panel.

1. Prerequisites – Plesk with the Node.js Extension

Before starting, verify the following:

  • Plesk 18.0 or newer
  • Node.js extension installed (Plesk → Extensions → Node.js)
  • SSH access to the subscription or root account
  • A domain or sub-domain that points to the subscription where the site will live

All commands below work on Debian/Ubuntu and AlmaLinux/Rocky/RHEL systems. Separate blocks are provided for each package manager.

2. Installing pnpm on the Server

pnpm is distributed as a Node.js script, so a recent Node version (≥ 14) is required. The Plesk Node.js extension usually supplies a default version, but you can install a newer one if needed.

Debian / Ubuntu (apt)

# Update the package list
sudo apt update

# Install Node.js (example: v18). Replace the version if required.
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs

# Verify the installations
node -v   # e.g., v18.x.x
npm -v    # matches the Node.js version

# Install pnpm globally
sudo npm install -g pnpm

# Confirm pnpm is available
pnpm -v

AlmaLinux / Rocky Linux / RHEL (dnf)

# Install EPEL for additional dependencies
sudo dnf install -y epel-release

# Add NodeSource repository for Node 18
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -

# Install Node.js and npm
sudo dnf install -y nodejs

# Verify the installations
node -v
npm -v

# Install pnpm globally
sudo npm install -g pnpm

# Confirm pnpm is available
pnpm -v

3. Preparing the Application in Plesk

With pnpm installed, create a new Node.js application through the Plesk UI.

  1. Log in to Plesk and navigate to Domains → your-domain.com → Node.js.
  2. Click Add Node.js Application. Choose the Node.js version you installed and set the application root (e.g., public_html or my-app).
  3. Leave Document root empty if you will serve a static build; the output folder will be configured later.
  4. Click OK to create the application. Plesk will generate a placeholder package.json if none exists.

Upload your source code via Git, SFTP, or the Plesk file manager. The example below assumes the source resides in /var/www/vhosts/your-domain.com/httpdocs.

4. Uploading the Project and Installing Dependencies with pnpm

After placing the files on the server, connect via SSH and run the following commands.

Debian / Ubuntu

# Change to the application directory
cd /var/www/vhosts/your-domain.com/httpdocs

# Activate the Node.js version managed by Plesk
source /opt/plesk/node/18/bin/activate   # adjust if you chose a different version

# Install dependencies using pnpm
pnpm install

# Verify the installation
pnpm ls

AlmaLinux / Rocky Linux / RHEL

# Change to the application directory
cd /var/www/vhosts/your-domain.com/httpdocs

# Load the Plesk-managed Node.js environment
source /opt/plesk/node/18/bin/activate   # adjust if needed

# Install dependencies
pnpm install

# List installed packages
pnpm ls

5. Building the Static Site

Static-site generators expose a build script in package.json. For example:

{
  "scripts": {
    "build": "next build && next export",
    "dev": "next dev"
  }
}

Replace the script with the one appropriate for your framework (e.g., gatsby build, vite build, or nuxt generate).

Run the Build from the Command Line

# Ensure the Node environment is active
source /opt/plesk/node/18/bin/activate

# Execute the build script
pnpm run build

After completion, the generated files will usually appear in a folder named out, dist, or public. Note the exact output path for the next step.

6. Configuring Plesk to Serve the Built Files

Static files should be served from the web root. Plesk allows you to point the document root to any sub-folder within your application directory.

  1. Return to Domains → your-domain.com → Node.js in the Plesk UI.
  2. Set Document root to the build output folder (e.g., out or dist).
  3. Choose Production for Application mode to disable the built-in Node.js server.
  4. Click Apply to save the configuration.

If you need the Node.js service to remain running (for server-side rendering), leave the document root empty and let the framework handle routing. For a pure static site, pointing the document root to the output folder lets Apache or Nginx serve the files directly, which is more efficient.

7. Automating Future Builds (Optional)

For sites that receive frequent updates, automate the build process using one of the following methods.

Git Hook + Cron

  • Enable the Git extension in Plesk and clone your repository into the application folder.
  • Configure a post-receive hook that runs pnpm install && pnpm run build after each push.
  • Optionally add a cron job that clears the pnpm store cache weekly to keep disk usage low.

Scheduled Plesk Task

# Command (adjust path to your project)
cd /var/www/vhosts/your-domain.com/httpdocs && \
source /opt/plesk/node/18/bin/activate && \
pnpm install && pnpm run build

Schedule the task in Tools & Settings → Scheduled Tasks (e.g., nightly at 02:00). This approach does not require Git but keeps the site up-to-date with local changes.

Conclusion

Using pnpm with Plesk’s Node.js extension provides a lightweight, fast package manager and a clear workflow for building static sites. By installing pnpm through the system package manager, configuring the Node.js environment via Plesk, and pointing the document root to the generated output, you can host modern JavaScript frameworks on an Indian-based VPS or dedicated server without leaving the familiar Plesk interface.

node.jspnpmpleskstatic-sitenext.jsgatsbyvitelinux

Try it on your own server

Follow along on a Cloud VPS with full root access, or read the step-by-step knowledge base guides.

Guides: VPS for WordPress · Node.js hosting · VPS or dedicated server · Paying by UPI