Hi team,
I just developed my node application using node version 8.5.0 and assume to be use latest features of ECMAScript. It works fine while using local in the development mode. I used pm2 for the production and it fails and giving error as SyntaxError: Unexpected token ... for the spread operator for creating the new object.
Here is the small POC done on that
const person = {
name: "Person Name",
age: "21"
};
const depttInfo = {
deptt: "IT"
};
const personsInfo = { ...person, ...depttInfo }
console.log(personsInfo)
and I started the server using the
"scripts": {
"start": "pm2 start ./index.js --no-daemon"
}
Thanks,
Arun Redhu
Please run pm2 report
My guess is that pm2 is not up to date with your Node 8.5.0, make sure you run pm2 update after updating node
I am using pm2 2.7.2. Here is the report from pm2 report
pm2 report
--- PM2 REPORT (Fri Nov 03 2017 23:21:16 GMT+0530 (IST)) ----------------------
--- Daemon -------------------------------------------------
pm2d version : 2.7.2
node version : 8.2.1
argv0 : node
user : arunkumar
uid : 502
gid : 20
uptime : 16min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 2.7.2
node version : 8.5.0
argv0 : node
user : arunkumar
uid : 502
gid : 20
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : darwin
type : Darwin
cpus : Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
cpus nb : 4
freemem : 255406080
totalmem : 8589934592
home : /Users/arunkumar
===============================================================================
--- PM2 list -----------------------------------------------
ββββββββββββ¬βββββ¬βββββββ¬ββββββ¬ββββββββββ¬ββββββββββ¬βββββββββ¬ββββββ¬βββββββββ¬ββββββββββββ¬βββββββββββ
β App name β id β mode β pid β status β restart β uptime β cpu β mem β user β watchingβ
ββββββββββββΌβββββΌβββββββΌββββββΌββββββββββΌββββββββββΌβββββββββΌββββββΌβββββββββΌββββββββββββΌβββββββββββ€
β index β 0 β fork β 0 β errored β 30 β 0 β 0% β 0 B β arunkumar β disabledβ
ββββββββββββ΄βββββ΄βββββββ΄ββββββ΄ββββββββββ΄ββββββββββ΄βββββββββ΄ββββββ΄βββββββββ΄ββββββββββββ΄βββββββββββ
===============================================================================
--- Daemon logs --------------------------------------------
/Users/arunkumar/.pm2/pm2.log last 20 lines:
PM2 | 2017-11-03 23:17:40: App [index] with id [0] and pid [12971], exited with code [0]via signal [SIGINT]
PM2 | 2017-11-03 23:17:40: Starting execution sequence in -fork mode- for app name:indexid:0
PM2 | 2017-11-03 23:17:40: App name:index id:0 online
PM2 | 2017-11-03 23:17:40: App [index] with id [0] and pid [12972], exited with code [0]via signal [SIGINT]
PM2 | 2017-11-03 23:17:40: Starting execution sequence in -fork mode- for app name:indexid:0
PM2 | 2017-11-03 23:17:40: App name:index id:0 online
PM2 | 2017-11-03 23:17:41: App [index] with id [0] and pid [12973], exited with code [0]via signal [SIGINT]
PM2 | 2017-11-03 23:17:41: Starting execution sequence in -fork mode- for app name:indexid:0
PM2 | 2017-11-03 23:17:41: App name:index id:0 online
PM2 | 2017-11-03 23:17:41: App [index] with id [0] and pid [12974], exited with code [0]via signal [SIGINT]
PM2 | 2017-11-03 23:17:41: Starting execution sequence in -fork mode- for app name:indexid:0
PM2 | 2017-11-03 23:17:41: App name:index id:0 online
PM2 | 2017-11-03 23:17:41: App [index] with id [0] and pid [12975], exited with code [0]via signal [SIGINT]
PM2 | 2017-11-03 23:17:41: Starting execution sequence in -fork mode- for app name:indexid:0
PM2 | 2017-11-03 23:17:41: App name:index id:0 online
PM2 | 2017-11-03 23:17:41: App [index] with id [0] and pid [12976], exited with code [0]via signal [SIGINT]
PM2 | 2017-11-03 23:17:41: Starting execution sequence in -fork mode- for app name:indexid:0
PM2 | 2017-11-03 23:17:41: App name:index id:0 online
PM2 | 2017-11-03 23:17:41: App [index] with id [0] and pid [12977], exited with code [0]via signal [SIGINT]
PM2 | 2017-11-03 23:17:41: Script /Users/arunkumar/Examples/pm2 example/index.js had too many unstable restarts (16). Stopped. "errored"
Most helpful comment
Please run
pm2 reportMy guess is that pm2 is not up to date with your Node 8.5.0, make sure you run
pm2 updateafter updating node