I have built an app with SvelteKit and @sveltejs/adapter-node and deployed it to a server managed with Plesk via Git. I have activated and configured the node.js-Plugin and set all paths correctly, but I cannot run it with Phusion Passenger (which is the application server used by Plesk). I am getting the following error:
/usr/share/passenger/helper-scripts/node-loader.js:80
return originalRequire.apply(this, arguments);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /var/www/vhosts/mydomain.host/build/index.js from /usr/share/passenger/helper-scripts/node-loader.js not supported.
Instead change the require of index.js in /usr/share/passenger/helper-scripts/node-loader.js to a dynamic import() which is available in all CommonJS modules.
at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
at loadApplication (/usr/share/passenger/helper-scripts/node-loader.js:243:2)
at setupEnvironment (/usr/share/passenger/helper-scripts/node-loader.js:214:2)
at Object.<anonymous> (/usr/share/passenger/helper-scripts/node-loader.js:133:1) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v17.6.0
Is there a solution to make my SvelteKit app run on Plesk?
I have already tried building an entry.cjs
file with import("index.js");
in it (as suggested in this thread), but it did not work as well.