• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question SvelteKit and Plesk Node : TypeError: Cannot read properties of undefined (reading 'on')

MarcelP

New Pleskian
Server operating system version
Debian 10.13
Plesk version and microupdate number
18.0.58
I'm encountering an issue while deploying a SvelteKit demo application on a Plesk server. After following the steps to get the SvelteKit demo ready for production, I performed a build which resulted in two directories: client/ and server/ and some files. To start the application, I created an entry.cjs file with the following line:
(() => import('./index.js'))();

I then set this entry.cjs file as the startup file in the Node.js application settings on Plesk.
However, when I try to access the application via the browser, I receive the following error:
App 32610 output: server.server.on(
App 32610 output: ^
App 32610 output:
App 32610 output: TypeError: Cannot read properties of undefined (reading 'on')
App 32610 output: at file:///var/www/vhosts/programr.events/httpdocs/build/index.js:285:15

It seems this error is related to an attempt to access an on method on an undefined server object. Here are the steps I've taken for deployment:
  • Build the SvelteKit application using npm run build, which producesclient/ and server/ directories.
  • Creation of the entry.cjs file to start the application.
  • Configuring entry.cjs as the startup file on Plesk.
1709931745122.png

I'm a bit lost on how to resolve this issue. Has anyone encountered this error before, or does anyone have an idea on how to correctly configure a SvelteKit application for deployment on a Plesk server?

Thank you in advance for your help.
 
A couple years ago i've the same issue.

Easy fix. You need to add an file named index.cjs in the root directory from your domain /for example httpdocs_new with the content:
(() => import('./build/index.js'))();
And your configuration should look like this:
1737719149909.png
it its enough to upload your build folder to plesk. I recommend use git for that with an webhook setup.
 
Back
Top