I am trying to run npm
custom scripts via pm2 using ecosystem.json
as,
{
"apps": [{
"name": "Service",
"script": "npm",
"args": "run command"
}]
}
Unfortunately I am unable to do it. Can anyone help me to get through this? I am getting as shown below,
C:\PROGRAM FILES\NODEJS\NPM.CMD:1
0|Service | (function (exports, require, module, __filename, __dirname) { ::
Created by npm, please don't edit manually.
0|Service | ^
0|Service | SyntaxError: Unexpected token :
0|Service | at createScript (vm.js:56:10)
0|Service | at Object.runInThisContext (vm.js:97:10)
0|Service | at Module._compile (module.js:542:28)
0|Service | at Object.Module._extensions..js (module.js:579:10)
0|Service | at Module.load (module.js:487:32)
0|Service | at tryModuleLoad (module.js:446:12)
0|Service | at Function.Module._load (module.js:438:3)
0|Service | at Object.<anonymous>
(C:\Users\AD001\AppData\Roaming\npm\node_modules\pm2\
lib\ProcessContainerFork.js:53:21)
0|Service | at Module._compile (module.js:570:32)
0|Service | at Object.Module._extensions..js (module.js:579:10)
this is a reported issue in pm2. you can work around by doing
//startscript.js
var exec = require('child_process').exec;
exec('npm start', {windowsHide: true});
then pm2 start startscript.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With