Pm2: PM2 does not work anymore on NodeJS V6

Created on 19 Nov 2019  路  4Comments  路  Source: Unitech/pm2

What's going wrong?

PM2 doesn't seem to work anymore on NodeJS v6, I think it has to do with the library Chokidar having dropped support to NodeJS versions older than 8; see pull request.
When I run pm2 start something.js the only output I get is [PM2] Spawning PM2 daemon with pm2_home=/home/root/.pm2.
pm2.log file contains the following error message:

async remove(item) {
        ^^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/Watcher.js:6:16)

How could we reproduce this issue?

Try to use PM2 with NodeJS v6

Supporting information

# pm2 report
[PM2] Spawning PM2 daemon with pm2_home=/home/root/.pm2

Am I missing something? Any idea on how I can make PM2 work with this old version of NodeJS?

Most helpful comment

If you want to run PM2 on Node v6 you'll have to use version 3.

npm install pm2@^3

All 4 comments

PM2 v4 does not support Node.js versions bellow 8.x, active support on LTS versions and current 13.x
https://travis-ci.org/Unitech/pm2

Hi Unitech,

I am using node version 8.12.0 and I am also getting the same error. Please find the error details below:-

/usr/src/app/node_modules/pm2/node_modules/chokidar/index.js:151
async remove(item) {
^^^^^^

SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/usr/src/app/node_modules/pm2/lib/Watcher.js:6:16)

Hey guys,

After we updated to the latest pm2 version, we also got this error and after a bit of reading I saw this node compatibility issue. The thing is that we recently updated to Node 13.10.1 and we still encounter this issue. It writes around 40-50MB of logs each day to that file, this being the only error. Any help, please? Error below:

/usr/lib/node_modules/pm2/node_modules/chokidar/index.js:151
    async remove(item) {
          ^^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/Watcher.js:6:16)

If you want to run PM2 on Node v6 you'll have to use version 3.

npm install pm2@^3

Was this page helpful?
0 / 5 - 0 ratings