funny-blue
funny-blue10mo ago

pm2 for production

hello, how to use pm2 for making a refine.dev app going live ? I got this error using a file called ecosystems.config.js with the following content: module.exports = { apps: [ { name: 'spiderlink', script: 'yarn', args: 'start', env: { NODE_ENV: 'production', }, exp_backoff_restart_delay: 100, }, ], }; then using pm2 start ecosystems.config.js i got this error: [PM2][ERROR] File ecosystems.config.js malformated Error [ERR_REQUIRE_ESM]: require() of ES Module /data_efs/node/spiderlink/spiderlink/ecosystems.config.js from /root/.nvm/versions/node/v18.18.2/lib/node_modules/pm2/lib/Common.js not supported. ecosystems.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead rename ecosystems.config.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /data_efs/node/spiderlink/spiderlink/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
3 Replies
kapa.ai
kapa.ai10mo ago
Hi @dannywhiteagile. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The information extracts provided do not contain specific details on how to use PM2 with a refine.dev application. However, you can refer to the official refine.dev documentation (https://refine.dev/docs) for more information on deploying refine.dev applications. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@1129002557419827210> kapa.ai is still learning and improving, please let us know how it did by reacting below
reduced-jade
reduced-jade10mo ago
[PM2][ERROR] File ecosystems.config.js malformated As the error mentions, you have invalid ecosystems.config.js file, please check for typos in this file.