pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

A problem about pm2, Express and CoffeeScript.

Open boringtu opened this issue 9 years ago • 5 comments

Emmmmm.. First, my English is so bad, so I perhaps cannot describe my problem clearly enough.. then..

What's going wrong?

I just want to run multiple Express instances(by CoffeeScript), but I can't.

How could we reproduce this issue?

my version

I generated a Express project with: express --view=pug --css=less --git t then I converted the file:./bin/www from Javascript to CoffeeScript (Just only this one file) and the line 1: #!/usr/bin/env coffee (Default is: #!/usr/bin/env node) then I did this modification into ./package.json (Default is: "start": "node ./bin/www") :

...
"scripts": {
  "start": "coffee ./bin/www"
},
...

Now, I begin to startup this project with pm2:

  • pm2 start ./bin/www --interpreter=coffee --name=t startup successful, and working well

  • pm2 start ./bin/www --interpreter=coffee --name=t -i 2 startup failed, and not working

  • pm2 start npm --name "t" -- run start startup successful, and working well

  • pm2 start npm --name "t" -i 2 -- run start startup (seemed) successful (but only one instance), just one instance in working

Supporting information

➜  t pm2 report
===============================================================================
--- PM2 REPORT (Sat Sep 23 2017 18:41:30 GMT+0800 (CST)) ----------------------
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 2.7.0
node version         : 8.4.0
node path            : /usr/local/bin/pm2
argv                 : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : Andy
uid                  : 502
gid                  : 20
uptime               : 1816min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 2.7.0
node version         : 8.4.0
node path            : /usr/local/bin/pm2
argv                 : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : Andy
uid                  : 502
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
cpus nb              : 8
freemem              : 1155276800
totalmem             : 17179869184
home                 : /Users/Andy
===============================================================================
--- PM2 list -----------------------------------------------
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

I just want to run multiple Express instances(by CoffeeScript), does anyone know how to do it? I need help~ I'm going to be mad..

boringtu avatar Sep 23 '17 11:09 boringtu

You can't launch use cluster mode with other interpreter because its using the nodejs implementation, so we need to use node for it to work.

vmarchaud avatar Sep 23 '17 11:09 vmarchaud

It's a node project, just by coffee, why cannot it run with cluster? Do I need to compile coffee into JavaScript? node project by typescript is the same?

boringtu avatar Sep 23 '17 12:09 boringtu

@vmarchaud hello?

boringtu avatar Sep 25 '17 02:09 boringtu

Just chicken ribs~ XD

boringtu avatar Sep 28 '17 10:09 boringtu

@BoringTu You need to have valid javascript code to run inside a cluster, so yeah you need to transpile it

vmarchaud avatar Sep 28 '17 10:09 vmarchaud