Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explain deployment with pm2 #182

Open
rudestewing opened this issue Jan 2, 2025 · 1 comment
Open

explain deployment with pm2 #182

rudestewing opened this issue Jan 2, 2025 · 1 comment

Comments

@rudestewing
Copy link

rudestewing commented Jan 2, 2025

refer to this Starting the production server got an error when follow the documentation


[PM2][ERROR] File ecosystem.config.js malformated
ReferenceError: module is not defined
    at file:///Users/rudisetiawan/Repositories/Rudestewing/adonis-api/ecosystem.config.js:1:1
    at ModuleJobSync.runSync (node:internal/modules/esm/module_job:395:35)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:329:47)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1414:24)
    at Module._compile (node:internal/modules/cjs/loader:1547:5)
    at Object..js (node:internal/modules/cjs/loader:1677:16)
    at Module.load (node:internal/modules/cjs/loader:1318:32)
    at Function._load (node:internal/modules/cjs/loader:1128:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
file:///Users/rudisetiawan/Repositories/Rudestewing/adonis-api/ecosystem.config.js:1
module.exports = {
^

ReferenceError: module is not defined
    at file:///Users/rudisetiawan/Repositories/Rudestewing/adonis-api/ecosystem.config.js:1:1
    at ModuleJobSync.runSync (node:internal/modules/esm/module_job:395:35)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:329:47)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1414:24)
    at Module._compile (node:internal/modules/cjs/loader:1547:5)
    at Object..js (node:internal/modules/cjs/loader:1677:16)
    at Module.load (node:internal/modules/cjs/loader:1318:32)
    at Function._load (node:internal/modules/cjs/loader:1128:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)

Node.js v22.12.0
@dunhamjared
Copy link
Contributor

This could happen when you're trying to use CommonJS modules (module.exports) in an environment that expects ES modules (export default)

Be sure your package.json type is set to "module", or try renaming the ecosystem.config.js file to ecosystem.config.mjs so node treats it like an ES module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants