DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk12 min

PM2 Says “node” Not “nodejs” on Ubuntu: Diagnose and Fix the Interpreter

PM2 normally calls its default interpreter node, while some Ubuntu releases expose Node.js as nodejs. Learn how to diagnose PATH and daemon differences, configure an absolute interpreter, verify the process, and keep the fix working after reboot.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PM2 normally says node because that is its default interpreter name. It does not mean your application needs an Ubuntu package literally called node. On some Ubuntu releases, the Node.js executable was exposed as nodejs because an unrelated package already used the node name. Find the executable that the PM2 daemon can actually access, then either point PM2 to its absolute path or install a supported Node.js setup that provides a compatible node command.

The reliable fix is to test the commands as the PM2-owning user, inspect PM2’s daemon environment, set interpreter explicitly when necessary, and verify the result after a restart and reboot configuration.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why PM2 says node instead of nodejs

For JavaScript applications, PM2’s default interpreter is named node. Its ecosystem configuration defines interpreter as an absolute path and lists node as the default value. PM2 also chooses an interpreter from the script’s file extension and allows an explicit override with --interpreter.

Therefore, a PM2 message mentioning node generally describes the executable PM2 is trying to launch. It is not proof that your code imports a package called node, and it is not by itself an indication that the application is broken.

Ubuntu’s command naming has varied by release. Historical Ubuntu guidance explains that the Node.js runtime was called nodejs on affected releases because the name node was associated with an unrelated Amateur Packet Radio Node Program package. Those instructions are release-specific. A current machine may have a different repository layout, compatibility package, symlink, or version-manager installation, so inspect the actual system before changing anything under /usr/bin.

First determine which executable exists

Run the checks as the same Linux user who owns the PM2 processes. Testing as root or from a different account can hide a user-specific PATH or version-manager installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Locate both possible command names:

    command -v node
    command -v nodejs

    An output such as /usr/bin/node, /usr/local/bin/node, or a path inside a user-owned version-manager directory identifies the executable available in that shell. A blank result means the command is not on that user’s PATH.

  2. Check the version for every command that was found:

    node --version
    nodejs --version

    Only run a command if command -v found it. Record both the path and version; two names can exist while pointing to different Node.js installations.

  3. Capture PM2’s own context:

    pm2 report
    pm2 list
    pm2 describe <app-name>

    Replace <app-name> with the process name shown by pm2 list. These commands show whether the process is online, which user is managing it, and details useful for identifying a daemon PATH mismatch.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. Read the application and PM2 error output:

    pm2 logs <app-name>

    Look for an executable-not-found message, a permission error, an incompatible runtime error, or an application-level exception. Do not treat every mention of node as a package-installation problem.

Interpret the common results

Shell result What it indicates Next action
node exists and reports the intended version The interactive shell can find a suitable Node.js runtime. Check PM2’s daemon and process configuration; the daemon may have a different PATH.
Only nodejs exists This matches historical Ubuntu naming on some releases. Use the absolute nodejs path in PM2, or adopt a maintained installation that supplies the expected command.
Neither command exists No Node.js executable is available to this user’s PATH. Install Node.js using a supported method for the Ubuntu release, then repeat the path and version checks.
Both exist but versions differ PATH order, symlinks, or a version manager is selecting different runtimes. Choose the intended binary explicitly and configure PM2 with its absolute path.

Preferred fix: set PM2’s absolute interpreter path

An absolute interpreter path removes ambiguity about command names and PATH order. It is the most predictable approach for a daemon and for a boot-time service.

Find the path you want PM2 to use

Use the result of command -v node if it points to the intended Node.js runtime. If only nodejs exists, use the path returned by command -v nodejs. Confirm its version before placing it in configuration:

command -v node
command -v nodejs
/usr/bin/node --version

Replace /usr/bin/node in the final command with the actual path you selected. A path inside a per-user version manager can work, but it must remain available to the PM2 service after logout and reboot; the boot-service considerations later in this guide are important.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure an ecosystem file

In ecosystem.config.js, set interpreter to the absolute executable path:

module.exports = {
  apps: [{
    name: "my-app",
    script: "./app.js",
    interpreter: "/absolute/path/to/node"
  }]
};

Use the exact path returned by command -v, such as the intended node or nodejs binary. Keep the rest of the application settings unchanged while diagnosing the interpreter so that a runtime fix is not confused with an unrelated application change.

Apply the ecosystem configuration

Restart the process from the updated file. If the process already exists, use the ecosystem file to reload it so PM2 receives the new interpreter setting:

pm2 start ecosystem.config.js
pm2 list
pm2 describe my-app
pm2 logs my-app

If your deployment uses a different PM2 action to reload an existing process, follow that deployment’s normal process-management procedure; the essential point is that the process must be recreated or reloaded from the file containing the corrected interpreter.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a one-off command when you do not have an ecosystem file

PM2’s command-line override is equivalent for a single launch:

pm2 start app.js --interpreter /absolute/path/to/node

Substitute the selected executable path. For repeatable deployments, an ecosystem file is easier to audit because the interpreter choice is recorded alongside the application definition.

Alternative fix: provide a compatible node command

If your Ubuntu installation exposes Node.js only as nodejs, you can install Node.js through a maintained method that supplies the expected node command. Which repository, package, or version manager is appropriate depends on the Ubuntu release and your organization’s update policy.

Older Ubuntu documentation identified a compatibility package named nodejs-legacy for affected releases. Treat that as historical guidance, not a universal command for current systems. Before installing it, confirm that the package exists for your release and that it represents the Node.js runtime rather than an unrelated package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After making a system-level change, verify both command resolution and the version:

command -v node
node --version
command -v nodejs
nodejs --version

Do not create or overwrite /usr/bin/node blindly. The historical naming conflict is precisely why an apparently harmless symlink can select the wrong software or interfere with distribution-managed packages. Prefer a supported package or administrator-managed compatibility command, and keep the selected Node.js version auditable.

Why a shell alias usually does not solve PM2

An alias such as alias node=nodejs in .bashrc affects an interactive shell only. PM2 runs a daemon, and a startup service may launch without reading your interactive shell initialization files. The result is a familiar failure pattern: node works when typed manually, while PM2 reports that it cannot find or execute node.

Use one of these durable alternatives instead:

  • Set PM2’s interpreter to an absolute Node.js path.
  • Install a system-managed command that resolves to the intended Node.js runtime.
  • Ensure the PM2 service environment has the correct PATH, while still preferring an explicit interpreter for predictable deployments.

You can use an alias for personal shell convenience, but do not treat it as the server-side fix.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Shell PATH versus PM2 daemon PATH

PM2’s daemon inherits an environment when it starts. That environment may differ from the shell in which you ran command -v node. Differences commonly arise when Node.js was installed for one user, loaded by a version manager, or added to PATH only by an interactive profile.

Signs of a daemon environment mismatch

  • node --version succeeds in your terminal, but PM2 logs show that node cannot be found.
  • PM2 launches the process with a different Node.js version than the one shown by your shell.
  • The process works until logout or reboot, then fails when the startup service restores it.
  • pm2 describe shows a process that is stopped or repeatedly restarting even though the script runs directly from the shell.

How to narrow it down

  1. Run command -v node and node --version as the PM2-owning user.
  2. Run pm2 report and inspect the user and environment details it provides.
  3. Check pm2 describe <app-name> for interpreter and process information.
  4. Compare the PM2 error log with a direct invocation of the application using the selected absolute Node.js path.
  5. If the direct absolute-path invocation works but PM2 does not, set interpreter explicitly rather than relying on PATH discovery.

An absolute path does not magically make an inaccessible file usable: the PM2 user still needs execute permission on the binary and traverse permission on its parent directories. It does, however, remove command-name and PATH-order ambiguity.

Choosing among the available fixes

Fix pattern Changes system-wide command resolution? Depends on Ubuntu release? Works reliably for a boot service? Version auditing and upgrades
Absolute interpreter in ecosystem file No Low; it uses the path present on your system Usually strong, provided the path is readable and executable at boot Clear path, but update the file when changing Node versions
--interpreter for one launch No Low Only if the process definition is later saved with that setting Easy for testing; less centralized than an ecosystem file
Maintained installation that supplies node Often yes Depends on the selected installation method and release Strong when the command is system-managed and present at boot Depends on package or version-manager policy; record the chosen source and version
Historical compatibility package Yes High; availability is tied to older Ubuntu packaging Only after confirming the package and command on that release Requires careful validation because it may not exist or be current
Interactive shell alias No Low Weak; services normally do not read interactive aliases Poor, because the effective runtime is hidden in a shell profile

For a production process, the first option is generally the least ambiguous. A system-managed node command is also reasonable when it is supported by your release and operational policy. The historical compatibility package should be considered only after verifying release-specific availability.

Verify that PM2 is using the corrected runtime

After changing the interpreter, do not stop at a successful command prompt. Confirm the process in PM2’s own context.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Restart or reload the application from the corrected ecosystem file, or launch it with the absolute-path override.

  2. Check process state:

    pm2 list

    The application should remain online rather than entering a restart loop.

  3. Inspect its description:

    pm2 describe <app-name>

    Confirm that the process details reflect the intended launch configuration.

  4. Read recent output:

    pm2 logs <app-name>

    Look for normal application startup and the absence of executable-not-found or permission errors.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  5. Check the selected runtime directly using the exact path configured in interpreter:

    /absolute/path/to/node --version

If the application starts but behaves differently than it did in your shell, compare environment variables, working directory, user permissions, and Node.js versions. Correcting the interpreter name does not resolve application errors caused by missing environment variables or incompatible dependencies.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make the correction survive a reboot

PM2’s quick-start procedure uses pm2 startup to generate an active startup script and pm2 save to preserve the process list for automatic restoration. Run these after the interpreter is corrected:

pm2 startup
pm2 save

The pm2 startup command normally prints a further command that must be run with administrator privileges to install the generated service. Follow the exact command PM2 prints for your account and system; do not substitute a service name from another machine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After saving, test the operational result rather than assuming it is complete:

  1. Confirm the ecosystem file or process definition contains the intended absolute interpreter.
  2. Run pm2 save again after any later process-definition change.
  3. Reboot during a maintenance window.
  4. After the system returns, run pm2 list, pm2 describe <app-name>, and pm2 logs <app-name>.
  5. Verify that the restored process uses the same Node.js runtime and remains online.

Special caution for per-user version managers

If Node.js came from a per-user version manager, its executable path may be unavailable to a boot service or may change when versions are switched. An absolute interpreter path makes the choice explicit, but you must also ensure the service account can access that path at startup. Review the command generated by pm2 startup and the service user, then test after reboot.

When upgrading Node.js, do not assume that a version-manager switch updates an existing PM2 process. Update the ecosystem file if the absolute path changes, recreate or reload the process, verify the logs, and run pm2 save so the corrected definition is what the startup service restores.

Troubleshooting branches

PM2 says “command not found: node”

Run command -v node and command -v nodejs as the PM2 user. If only nodejs exists, set interpreter to its absolute path or install a supported command named node. If neither exists, install Node.js using a maintained method for that Ubuntu release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

node works in the terminal but not in PM2

This is usually an environment mismatch. Avoid relying on a .bashrc alias or PATH modification intended only for interactive shells. Configure the absolute interpreter and then restart the PM2 process and daemon as required by your deployment.

PM2 uses the wrong Node.js version

Compare the versions reported by node --version, nodejs --version, and the exact path selected for interpreter. If multiple installations exist, choose one path deliberately and record it in the ecosystem file. Reload the process after changing the path.

The process starts, then stops immediately

First separate interpreter problems from application problems. pm2 logs <app-name> may show a JavaScript exception, missing dependency, invalid environment variable, or permission error after Node.js successfully launches. If the logs contain an application error rather than an executable error, troubleshoot that application condition instead of changing command names.

A reboot brings the old failure back

Check whether the startup service was installed with pm2 startup and whether the corrected process list was saved with pm2 save. Then verify that the service account can access the configured absolute interpreter at boot. A shell-only installation or alias can disappear outside an interactive login.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PM2 and Node.js version scope

The current PM2 npm package listing describes PM2 as a process manager for Node.js and Bun applications, states support for Node.js 18 and newer, and documents global installation with npm install pm2 -g. Check the PM2 package and official documentation that apply to the versions in your deployment before following older Ubuntu recipes. A command that was appropriate for an older Ubuntu release may be unavailable or unsuitable on a current one.

The durable method is independent of the historical package name: identify the executable with command -v, check its version, configure PM2 with an absolute path when there is any ambiguity, inspect the daemon context, and verify after restart and reboot.

Practical checklist

  • Run command -v node and command -v nodejs as the PM2-owning user.
  • Record the version returned by each available command.
  • Use pm2 report, pm2 list, and pm2 describe <app-name> to inspect PM2’s context.
  • Read pm2 logs <app-name> before changing packages.
  • Set interpreter to the intended absolute Node.js path in ecosystem.config.js, or use --interpreter for a one-off test.
  • Do not overwrite /usr/bin/node blindly.
  • Do not depend on a .bashrc alias for a server service.
  • Restart or reload the process and verify its state and logs.
  • Run pm2 startup and follow the generated installation command.
  • Run pm2 save, then test restoration after reboot.

Frequently Asked Questions

Does PM2 require an Ubuntu package named node?

No. PM2’s default interpreter is named node, but that refers to the executable it launches. If your system provides the Node.js runtime as nodejs, configure PM2 with that executable’s absolute path.

Can I fix this permanently with alias node=nodejs?

Not reliably. PM2’s daemon and startup service may not read your interactive shell aliases. Use an absolute interpreter path or a system-managed command instead.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does the fix work until the server reboots?

The boot service can have a different PATH or user environment from your terminal. Recreate the process with the corrected interpreter, run pm2 startup and pm2 save, and verify that the service account can access the selected executable at boot.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.