Plesk - Node.js
Foreword
The following help center article describes the basic mechanisms of web hosting for Node.js web applications in Plesk.
Prerequisites
- Plesk server
Manage Node.js versions
In the Node.js version management, you can easily install, uninstall, activate or deactivate the versions provided by Plesk. You can access the Node.js version management via Extensions → My Extensions → Node.js Toolkit (Open).
A version can be deactivated by clicking on the green tick icon and activated again by clicking on the gray X icon. It is important to note that a version can only be uninstalled if it was previously deactivated and is no longer used by any domains in Plesk.
Activate Node.js for domain for the first time
If you cannot see Node.js in the dashboard view of your subscription, Node.js must be activated for the first time. To do this, navigate as follows: First steps → Node.js → Activate Node.js.
\nFrom now on, you can access the Node.js hosting settings via the developer tools in the dashboard view.
Node.js hosting settings
The individual hosting settings for Node.js web applications are described below.
Node.js version
This can be used to select the Node.js version required for the domain, which is installed on the server, see <link to /h2 Manage Node.js versions, if released>
Package Manager
Plesk provides npm and Yarn, which you can choose between to install and manage Node.js packages for your application.
Document master
This is where the static files of the Node.js web application are located.
Application mode
In application mode, you can choose between production and development, the latter enables better debugging of the application by the Phusion Passenger web server.
Application root
The application root is the directory in which the Node.js project is located. In this directory there is usually a package.json, which contains the project dependencies and the application start file of the Node.js application.
Application start file
This file contains the programming instructions for starting and initializing the application and is required by Plesk. If the file is not available, please contact the developer of the application.
User-defined environment variables
Here you can define your own environment variables that can be accessed during the application runtime.
Install Node.js package dependencies
The package dependencies of a Node.js project are located in the file package.json
. This file must exist so that the package dependencies can be installed via the Plesk Control Panel.
If there is a package.json
in the application root, the dependencies can be installed via the gray button + npm installation. The required packages can then be found in the node_modules/
directory of the application root.
Application start file
The application startup file is always started by the Phusion Passenger Webserver, which establishes the connection between NGINX and Node.js in a special way, so it does not matter which app listener port you specify in the app.js
.
If you have difficulties developing an app.js
that initializes your web application correctly, please contact an agency that has experience with Node.js + Plesk servers.
Add package to package.json
To install a package and add it to the dependencies in the package.json
, you can execute the following command or add the package manually in the package.json.
npm install <package-name>@<version>
Frequent error messages
nodenv: npm: command not found
The error occurs if no Node.js version has been selected yet. The error message also lists the main version numbers of the Node.js versions currently installed in Plesk.
Example output:
nodenv: npm: command not found
The `npm' command exists in these Node versions:
22
24
To make the npm command executable for Node.js version 22, please execute the following command.
nodenv local 22
We're sorry, but something went wrong
This is an error message from the Phusion Passenger Webserver, which can have various origins. This output is the production error output of the web server, which is why you must set the application mode to development for more details.
Please note that this can pose a potential security risk, as the output may contain confidential information about the structure of your project, depending on the error. For this reason, the use of application mode development is only recommended in a protected environment.
Error starting web application (Cannot find module)
The highlighted error message indicates that the application start file app.js
could not be found in the application root. Make sure that the file exists in the application root or rename the corresponding file in the file system or in the Node.js hosting setting so that the corresponding file can be started by the web server.
Error starting web application (EACCES: permission denied, open)
The web server reports back that it cannot open the application start file due to a lack of authorization. Log on to the server with ssh
and navigate to the application root.
The authorizations should be adjusted here as follows:
chmod 0644 app.js
The file owner and group should be as follows:
chown <system user>:psacln app.js