Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
Blog

PM2 Says “node” Not “nodejs”: How to Fix It on Ubuntu

PM2’s “node” message usually identifies its default interpreter, not a required package. Learn how to find Ubuntu’s actual Node.js executable, configure PM2 safely, verify the daemon environment and survive reboot.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PM2 is normally telling you which executable it is trying to launch, not demanding a package literally named node. PM2 uses node as its default JavaScript interpreter, while some Ubuntu releases exposed the Node.js runtime as nodejs. Find the executable available to the PM2 user, then set PM2’s interpreter to that executable’s absolute path. Verify the daemon context and recreate PM2’s startup state after the change.

What PM2’s “node” message actually means

PM2 chooses an interpreter for an application from the script’s file extension. For JavaScript files, its default interpreter name is node. The name appears in process details and errors because it identifies the runtime command PM2 intends to execute; it does not prove that your application needs an Ubuntu package named node.

As an Amazon Associate I earn from qualifying purchases.

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.

PM2’s ecosystem configuration accepts an absolute interpreter path. That is the most deterministic fix because it bypasses differences between interactive shells, service environments, Ubuntu releases and user-specific version managers. A one-time command-line override is also available through --interpreter.

Why Ubuntu can have nodejs instead of node

Older Ubuntu packaging had a naming conflict. The name node was associated with an unrelated Amateur Packet Radio Node Program, while the Node.js executable was supplied as nodejs on affected releases. Historical Ubuntu guidance referred to nodejs-legacy as a compatibility package that could provide a node command.

That behavior is release-specific. Current Ubuntu installations may use different repositories, package names, symbolic links or version managers. Do not install an old compatibility package or replace /usr/bin/node until you have identified the release and the binaries actually present on the machine.

Diagnose the executable PM2 can use

Run the checks as the same Unix account that owns the PM2 process list. Running them as your login user and then starting PM2 under another account can produce a misleading result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Locate both command names. Run:
command -v node
command -v nodejs

Each successful command prints the path selected by that shell. A blank result means that command is not on that user’s PATH.

  1. Check the runtime versions. For every command that exists, run:
node --version
nodejs --version

Record the path and version together. Two command names can point to different installations, and PM2 may be using neither one if its daemon has a different environment.

  1. Capture PM2’s process context. Run:
pm2 report
pm2 list
pm2 describe <app-name>

Replace <app-name> with the actual PM2 application name. The report helps identify the PM2 installation and daemon context; the list shows whether the process is online, stopped or repeatedly restarting; and the description exposes the interpreter and paths associated with one application.

  1. Read the application error stream.
pm2 logs <app-name>

Look for an executable-not-found error, a permission error, a JavaScript exception after Node starts, or a restart loop. These indicate different problems and should not be treated as interchangeable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Repeat the command lookup in the service account. If PM2 belongs to a dedicated account, use that account explicitly, for example:
sudo -u pm2user -H sh -lc 'command -v node; command -v nodejs; node --version 2>/dev/null; nodejs --version 2>/dev/null'

Substitute the real account name. A command that works in your terminal may be unavailable to the PM2 daemon because non-interactive services do not load your shell profile.

  1. Identify which path is the intended Node.js runtime. Choose the binary that belongs to the Node.js installation you want this application to use, not merely the first command that happens to return a result.

How to read common diagnostic results

Result Meaning Next action
node and nodejs both exist Ubuntu exposes two command names, potentially for different installations. Compare their paths and versions, then configure PM2 with the intended absolute path.
Only nodejs exists The runtime is available, but the command PM2 defaults to is absent from this account’s path. Use the nodejs path as PM2’s interpreter or install Node.js through a maintained method that supplies node.
Only node exists The expected command is present, but PM2 may still have a different PATH. Set the absolute path and inspect PM2’s daemon context.
Neither command exists Node.js is not installed for this account, or its installation is not exposed in the service environment. Install Node.js using an appropriate maintained method, then repeat the path and version checks.
The path exists but execution is denied Permissions, mount options or account ownership prevent the PM2 user from running the binary. Correct ownership or permissions through your administrator; do not work around it with a shell alias.

Preferred fix: set an absolute interpreter in the ecosystem file

Use the path returned by command -v for the Node.js runtime you selected. For a system installation, an ecosystem file might contain:

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

If your verified runtime is exposed as nodejs, use its actual path instead, such as /usr/bin/nodejs. Do not copy either example blindly; the path must match the binary and version you verified on this server.

After saving the file, start or restart the application from that configuration:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
pm2 start ecosystem.config.js --only my-app
pm2 describe my-app
pm2 logs my-app

If the application already exists in PM2, restart it from the updated ecosystem definition rather than relying on an old process entry. Confirm that the description shows the intended interpreter and that the logs contain application output instead of a launch error.

One-off fix with --interpreter

For a temporary test or a single application, pass the absolute path directly:

pm2 start app.js --interpreter /usr/bin/nodejs

Replace /usr/bin/nodejs with the path found during diagnosis. This override affects that PM2 start operation; storing the setting in the ecosystem file is easier to audit and repeat during deployments.

Providing a compatible node command

Another approach is to use a maintained Node.js installation method that supplies the conventional node command. On older Ubuntu releases where it was available, the historical nodejs-legacy package supplied compatibility behavior. Its availability and suitability depend on the release, so treat that package as legacy guidance rather than a universal current fix.

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

Do not overwrite /usr/bin/node blindly or create an unmanaged symlink. Ubuntu’s historical naming conflict involved an unrelated package, and replacing a system-owned command can break package management or another program. If an administrator provides a compatibility command, verify it afterward:

command -v node
node --version

Then run the same checks under the PM2 service account and inspect pm2 describe. A command that resolves for root or for your login user is not automatically available to the account running the daemon.

Why a shell alias does not reliably fix PM2

An alias such as alias node=nodejs in .bashrc only changes interactive shells that read that file. PM2’s background daemon and its boot-time service normally do not load an interactive alias. The application can therefore work when launched manually while failing under PM2.

Use an absolute interpreter path in the ecosystem file, or install a system-managed command visible to the service account. Keep aliases for personal convenience, not as the production mechanism that selects the runtime.

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

Node version managers and PM2’s daemon environment

Per-user version managers place Node binaries in user-specific directories and often modify PATH from shell startup files. PM2 may have been started before a version switch, under another account, or from a service that does not source those files. The result is a mismatch: node --version in your terminal reports one version, while PM2 cannot find Node or launches another version.

Resolve this by selecting the version deliberately and recording its absolute executable path. Then set that path as interpreter, restart the PM2 application and check the service account’s environment. If the version manager later removes or replaces that path, PM2 will fail again; keep the selected Node installation stable or update the ecosystem file as part of the upgrade procedure.

Verify the correction

Verification should prove both that PM2 can launch the binary and that the application remains healthy after launch.

  1. Run pm2 describe <app-name> and confirm the configured interpreter and script paths.
  2. Run pm2 logs <app-name> and check for normal application startup rather than “file not found,” permission or immediate-exit messages.
  3. Run pm2 list and confirm the process is online without a restart loop.
  4. Repeat the version lookup in the PM2 service context when possible. This catches a PATH difference that an interactive shell conceals.
  5. Exercise a real application endpoint or job and verify its expected behavior; a process marked online can still be failing inside application code.

If PM2 still reports node after you configured nodejs, inspect the active ecosystem file and the application’s stored process definition. You may have restarted a different PM2 instance or left an older process entry running.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make the fix survive a reboot

PM2’s startup workflow uses pm2 startup to generate an operating-system startup command and pm2 save to persist the current process list. Run these only after the interpreter correction has been verified:

pm2 startup
pm2 save

The startup command may print an additional command that must be executed with administrator privileges; follow the command PM2 outputs for your account and system. Then reboot during a maintenance window or restart the service and verify pm2 list again.

When Node.js came from a per-user version manager, inspect the generated startup configuration carefully. The boot service must be able to resolve the absolute interpreter path without an interactive shell. If the path is inside a user-managed directory, ensure the service account can read and execute every directory component.

Compare the available fixes

Fix Changes system-wide command resolution? Ubuntu-release dependence Boot-service reliability Audit and upgrade effort
Absolute interpreter in ecosystem file No Low; uses the path you verify High, provided the path remains accessible Low; the selected binary is visible in configuration
--interpreter for one start No Low Medium; the setting is easy to lose when recreating the process Medium; repeat the option consistently
Maintained installation exposing node Usually yes for the chosen account or system Depends on the installation method and release High if the command is system-managed and on the service path Medium; upgrades can change the selected binary
Historical nodejs-legacy package Yes on releases that provided it High; not a current universal recommendation Variable; verify package and service behavior High; legacy packaging may not match current Node versions
Shell alias No Low Low; non-interactive PM2 services generally do not load aliases High risk of hidden drift

Troubleshooting branches

PM2 says “command not found” immediately

Confirm the absolute path with command -v, test that exact path directly, and verify that the PM2 account can execute it. If the path is correct but PM2 still fails, inspect whether the application was started by another PM2 home directory or another Unix user.

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.

The process starts, then exits repeatedly

This usually means the interpreter was found and the failure moved into application startup. Read pm2 logs <app-name> for JavaScript exceptions, missing environment variables, unavailable working-directory files or port conflicts. Do not keep changing the Node command when the log shows an application-level error.

The wrong Node version runs

Compare the version printed by the selected absolute path with the version reported by your shell. Set the desired binary explicitly in interpreter, restart from the ecosystem file and verify the resulting process context.

Manual starts work but reboot starts fail

Check the generated PM2 startup service, the account under which it runs and whether the configured interpreter path is readable at boot. Re-run pm2 startup and pm2 save after changing the process definition, then inspect the post-reboot PM2 list and logs.

Changing node breaks another Ubuntu program

Undo an unmanaged symlink or package change through your administrator and restore the distribution-managed command. Keep the application-specific fix inside PM2’s ecosystem configuration instead of changing a shared system path.

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

Version and scope notes

The current PM2 package listing describes PM2 as a process manager for Node.js and Bun applications, supports Node.js 18 and newer, and documents global installation with npm install pm2 -g. Check the PM2 package and documentation that match your deployment before applying instructions written for older Ubuntu releases.

The durable procedure is independent of the historical package name: identify the executable with command -v, verify its version as the PM2 user, configure an absolute interpreter when necessary, inspect the daemon after restart and persist the corrected process list for boot.

Final operating checklist

  • Run command -v node and command -v nodejs as the PM2 owner.
  • Record the version returned by the executable you intend to use.
  • Inspect pm2 report, pm2 list, pm2 describe and pm2 logs.
  • Set the verified absolute path in ecosystem.config.js, or use --interpreter for a temporary test.
  • Avoid relying on .bashrc aliases or blindly replacing /usr/bin/node.
  • Restart from the updated configuration and confirm the application’s real behavior.
  • Run pm2 startup and pm2 save only after the corrected process is stable.

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 quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.