Open dhowe opened 4 years ago
HI @dhowe, did you manage to solve this issue?
I think (it was > 5 month ago that I posted this ticket) that removing the 'instances' field did it, though better documentation would have been useful. Current config:
module.exports = {
apps : [{
name: 'specserv',
log_file: 'specserv.log',
script: 'server.js',
node_args: '--require=esm',
autorestart: true,
watch: false,
max_memory_restart: '1G',
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_ENV: 'production'
}
}]
};
@david-saint I had an issue, where everything worked in fork mode, but cluster mode did not.
Turns out all I had to do was make a node_modules folder in ~/.pm2
mkdir -p ~/.pm2/node_modules
No clue why this happens. A lot of frustrating hours wasted.
Same issue here, solved by changing from cluster mode to fork as suggested by @dhowe. No idea why this happens, seems to be a new bug since I'm pretty sure this has worked before.
For some reason the pm2
metadata stored in ~/.pm2
got something wrong at some stage.
The way I could solve this particular issue, with no working-around needed (preserving everything in my project as it was):
npm uninstall -g pm2
rm -r ~/.pm2
npm install -g pm2
.pm2
folder was necessary (reinstall alone would not solve it)After the above, pm2 start ecosystem.config.js
worked again with esm
.
Super weird issue but @rellampec 's response worked for me. Has anybody notified PM2?
For some reason @rellampec response worker here too!
For anyone still looking at this in 2022, I solved it by installing the esm package at the project root with; cd ~ npm i esm
Try this if all else fails. I think pm2 searches for the esm package at the project root not in the project folder.
Launched via $ pm2 start ecosystem.config.js, with config:
Please copy/paste the above report in your issue on https://github.com/Unitech/pm2/issues