Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

A Node.js app hosted in Plesk is not working: require() of ES Module is not supported

 
anonymousapplications extensionsdomainsgithubgo

Symptoms

  • A Node.js application is not loading. The following error message is logged in /var/log/passenger/passenger.log:

    App 266293 output: Error [ERR_REQUIRE_ESM]: require() of ES Module /var/www/vhosts/wachatbot.org/httpdocs/app.js from /usr/share/passenger/helper-scripts/node-loader.js not supported.
    App 266293 output: Instead change the require of app.js in /usr/share/passenger/helper-scripts/node-loader.js to a dynamic import() which is available in all CommonJS modules.
    App 266293 output: at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
    App 266293 output: at loadApplication (/usr/share/passenger/helper-scripts/node-loader.js:243:2)
    App 266293 output: at setupEnvironment (/usr/share/passenger/helper-scripts/node-loader.js:214:2)
    App 266293 output: at Object.<anonymous> (/usr/share/passenger/helper-scripts/node-loader.js:133:1) {
    App 266293 output: code: 'ERR_REQUIRE_ESM'
    App 266293 output: }

  • Node.js application startup file has import statements:

    import React from "react";
    import Link from "next/link";

Cause

According to this Phusion Passenger thread in GitHub, new ESM syntax cannot be used to import modules in Node.js:

Currently, we can't use the new ESM syntax to import modules in Node.js
That's because, inside the loadApplication function in src/helper-scripts/node-loader.js, we use require to start the application, instead, we should use childProcess.fork so we can support both CommonJS and ESM imports not only CommonJS as it is currently the case, it should not break existing applications and older Node.js versions, as you can see in the documentation, it is supported since Node.js v0.5.0 (see: https://nodejs.org/dist/latest-v16.x/docs/api/child_process.html#child_process_child_process_fork_modulepath_args_options).

Resolution

Apply the workaround suggested by the Phusion Passenger github page:

1. Create a new application startup file _passenger.cjs in the application home directory.

2. Open it and add the following content:

async function main () {
await import('./app.js')
}

main()

where app.js is the application startup file.

3. Go to Domains > example.com > Node.js and change Application Startup File to _passenger.cjs.

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

How to Host a Go App on Plesk

Read More »

Exploring Plesk’s Added Value Solutions So Far in 2023

Read More »

Unveiling Sitejet Builder: The Perfect Match for Your Effortless Website Creation Needs

Read More »
Knowledge Base

Does Node.js on Plesk support WebSockets (socket.io)?

Read More »

How to install and run Node.js application in Plesk?

Read More »

WordPress Admin Dashboard is not displayed properly on a website hosted in Plesk: “access forbidden by rule” or “client denied by server configuration”

Read More »

A website hosted in Plesk uses an old SSL certificate or is not accessible via HTTPS: ERR_CONNECTION_RESET

Read More »

Hosting Wiki

  • Django
  • GIT
  • JSON
  • Google Cloud CDN
  • AMP
  • GitHub
  • JSP
  • Linux
  • MongoDB
  • Domain
  • Plesk
  • HTTP
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family