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

.mjs config support #3478

Closed
damianobarbati opened this issue Feb 20, 2018 · 1 comment
Closed

.mjs config support #3478

damianobarbati opened this issue Feb 20, 2018 · 1 comment

Comments

@damianobarbati
Copy link

Command:

pm2 startOrReload ./config/pm2.config.mjs --env development -i 1

Config pm2.config.mjs:

import pkg from '../package';

module.exports = {
    name: pkg.name,
    script: 'index.mjs',
    exec_mode: 'cluster',
    node_args: '--harmony --trace-deprecation --experimental-modules --max_old_space_size=512',
    max_memory_restart: '512M',
    max_restarts: 3,
    restart_delay: 3000,
    min_uptime: 3000,
    error_file: 'logs/error.log',
    out_file: 'logs/output.log',
    watch: ['package.json', 'index.mjs', 'config/', 'api/', 'models/'],
    env_development: {
        NODE_ENV: 'development',
    },
    env_staging: {
        NODE_ENV: 'staging',
    },
    env_production: {
        NODE_ENV: 'production',
    }
};

Error:

/usr/local/lib/node_modules/pm2/lib/API.js:898
  if (config.deploy)
             ^

TypeError: Cannot read property 'deploy' of undefined
    at module.exports.API._startJson (/usr/local/lib/node_modules/pm2/lib/API.js:898:14)
    at Command.<anonymous> (/usr/local/lib/node_modules/pm2/bin/pm2:309:9)
    at Command.listener (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:160:13)
    at Command.parseArgs (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:653:12)
    at Command.parse (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:475:21)
    at beginCommandProcessing (/usr/local/lib/node_modules/pm2/bin/pm2:142:13)
    at /usr/local/lib/node_modules/pm2/bin/pm2:216:7
    at /usr/local/lib/node_modules/pm2/lib/API.js:169:14
    at /usr/local/lib/node_modules/pm2/lib/Client.js:54:16
@wallet77
Copy link
Contributor

wallet77 commented Jul 4, 2018

PM2 3.0.0 has been released:

$ npm install pm2@latest -g
$ pm2 update

Be aware of breaking changes, especially drop support for node 0.12.
Full list here : https://github.com/Unitech/pm2/blob/master/CHANGELOG.md

@wallet77 wallet77 closed this as completed Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants