Unitech / Unitech/pm2

babel-node not working when launching with ecosystem.config.js

Open
#4,780 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

babel-node doesn't transpile properly when launching app with a config.js file. Using CLI arguments works, ex: pm2 start --interpreter babel-node app.js.

When launching from the config.js file, what's weird is that when I run pm2 info app it says that the interpreter is babel-node, however I still get errors on my ES6 syntax. When launching with CLI arguments, it appears everything is transpiling correctly and no errors are logged.

How could we reproduce this issue?

The config file I use is:

  apps : [{
    name: 'app',
    script: 'app.js',
    watch: '.',
    interpreter: '/usr/bin/babel-node',
    exec_mode: 'fork'
  }]
};

The CLI command that works as expected is pm2 start --interpreter babel-node app.js

Supporting information

$ pm2 report

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the discrepancy using the supplied ecosystem.config.js and compare it with pm2 start --interpreter babel-node app.js. Start by tracing how the config-file interpreter value is handled versus the CLI value, then verify that an ES6 app launches without syntax errors in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.