pm2 start using jason file: SyntaxError: Unexpected token

Created on 1 Mar 2017  路  1Comment  路  Source: Unitech/pm2

Expected behaviour

I want to start an working 'app.js' application using a .jason file 'start_app_1.jason'.
I expect it to start and run as if directly launched using 'pm2 start app.js'

Actual behaviour

It failed, the log shows :

"""
30|start_a | /home/test/myapp/start_app_1.jason:2
30|start_a | "apps" : [{
30|start_a | ^
30|start_a | SyntaxError: Unexpected token :
30|start_a | at Module._compile (module.js:439:25)
30|start_a | at Object.Module._extensions..js (module.js:474:10)
30|start_a | at Module.load (module.js:356:32)
30|start_a | at Function.Module._load (module.js:312:12)
30|start_a | at Object. (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:53:21)
30|start_a | at Module._compile (module.js:456:26)
30|start_a | at Object.Module._extensions..js (module.js:474:10)
30|start_a | at Module.load (module.js:356:32)
30|start_a | at Function.Module._load (module.js:312:12)
30|start_a | at Function.Module.runMain (module.js:497:10)_
"""

Steps to reproduce

  • use a HelloWord express example as app.js
  • 'pm2 start app.js' works: app run and is online in pm2 list
  • use a start_app_1.jason like:
    {
    "apps" : [{
    "name" : "test_application",
    "args" : [],
    "env" : {},
    "script" : "app.js",
    "cwd" : "/home/test/myapp",
    "node_args" : [],
    "log_date_format" : "YYYY-MM-DD HH:mm Z",
    "exec_interpreter" : "none",
    "exec_mode" : "fork"
    }
    ]
    }
  • 'pm2 start start_app_1.jason' failled with above displayed error.

Did a lot of tries modifying the .jason file, nothing works :-(
Also try to start a bash script using .jason file, no luck. But also work if launched directly...

Help please......

Software versions used

OS         : ubuntu 14.04
node.js    : v0.10.25
PM2        : 2.4.1

PM2 Log output

2017-03-01 12:08:51: App name:start_app_1 id:30 online
2017-03-01 12:08:52: App [start_app_1] with id [30] and pid [25529], exited with code [1] via signal [SIGINT]
2017-03-01 12:08:52: Script /home/gilles/longRunningProcess/myapp/start_app_1.jason had too many unstable restarts (16). Stopped. "errored"
2017-03-01 12:11:58: App [test] with id [15] and pid [25094], exited with code [0] via signal [SIGINT]
2017-03-01 12:11:58: Starting execution sequence in -fork mode- for app name:test id:15
2017-03-01 12:11:58: App name:test id:15 online
2017-03-01 12:15:33: App [test] with id [15] and pid [27717], exited with code [0] via signal [SIGINT]
2017-03-01 12:15:33: Starting execution sequence in -fork mode- for app name:test id:15
2017-03-01 12:15:33: App name:test id:15 online
2017-03-01 12:19:08: App [test] with id [15] and pid [30172], exited with code [0] via signal [SIGINT]
2017-03-01 12:19:08: Starting execution sequence in -fork mode- for app name:test id:15
2017-03-01 12:19:08: App name:test id:15 online
2017-03-01 12:22:43: App [test] with id [15] and pid [32620], exited with code [0] via signal [SIGINT]
2017-03-01 12:22:43: Starting execution sequence in -fork mode- for app name:test id:15
2017-03-01 12:22:43: App name:test id:15 online
2017-03-01 12:26:18: App [test] with id [15] and pid [2948], exited with code [0] via signal [SIGINT]
2017-03-01 12:26:18: Starting execution sequence in -fork mode- for app name:test id:15
2017-03-01 12:26:18: App name:test id:15 online

Most helpful comment

Because the extension of the file need to be .json and not .jason, simply as that :)

>All comments

Because the extension of the file need to be .json and not .jason, simply as that :)

Was this page helpful?
0 / 5 - 0 ratings