I want to deploy my express.js project to cpanel, but the loading got stuck and when i check the errors it returned this:
[ E 2024-08-09 16:57:17.2850 1873213/Tg9 age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/skynetdi/skynet_crm_backend: The application process exited prematurely.
App 1191450 output: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/skynetdi/skynet_crm_backend/src/index.js from /opt/cpanel/ea-ruby27/root/usr/share/passenger/helper-scripts/node-loader.js not supported.
my package.json file:
"main": " app.cjs",
"type": "module",
"scripts": {
"start": "node app.cjs"
},
app.cjs:
(() => import('./src/index.js'))();
I already search for the problem, some article said i need to use the app.cjs and import the main file but it not solve the problem for me, i tried to run it from the terminal and it run perfectly fine, but when i run it from the setup node.js app the loading always stuck and the error always show require for esm.
Austin Nicholas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.