Open Mrgaton opened 9 months ago
You want to use bun as interpreter?
pm2 start --interpreter ~/.bun/bin/bun
Won't be nice to make that as default?
I don't see any disadvantage of not using bun
It won't be as easy as just stating "let's make a different interpreter the default". Here's some cons just for sake of argument:
So, while Node.js is still the most popular, complete and stable production-ready interpreter, in my opinion PM2 should stick with it and only start discussing about it when Node.js is surpassed in those areas.
Nothing against Bun, but you have to be realistic.
You want to use bun as interpreter?
pm2 start --interpreter ~/.bun/bin/bun
how i can make it permament and then how i can leave it as default?
Actually coming back to this, it seems that bun is the default already for typescript (bad decision if you ask me) since oct 6 2023: https://github.com/Unitech/pm2/commit/135c123adcb207f9c544bcc6c6853c3f8488fb31
That would mean that if you really want to use bun by default, either modify that file manually or use typescript extension.
I can't get pm2 to work with bun at all. Whatever I do pm2 always gives this error:
/usr/bin/env: 'node': No such file or directory
I have tried with command line arguments and with a configuration file. Still it seems to ignore the interpreter argument completely.
.bun/bin/pm2 start ecosystem.json
.bun/bin/pm2 start --interpreter bun index.js
.bun/bin/pm2 start --interpreter /usr/local/bin/bun index.js
ecosystem.json:
{
"apps": [
{
"name": "myapp",
"script": "index.js",
"interpreter": "/usr/local/bin/bun",
"instances": 1,
"exec_mode": "fork",
"autorestart": true,
"watch": false,
"error_file": "./errors.log",
"out_file": "./myapp.log"
}
]
}
You can run it with bun --bun pm2 start
. This will run bun instead of node, however, you'll immediately hit the next problem: cluster mode is not yet implemented in bun and pm2 tries to use that. Which will throw an error and exit.
Later edit: bun 1.1.25 has added support for cluster mode so the command above seems to be working now 💥
But it doesn't on work on ts
bun files, it still shows:
Failed to load Typescript interpreter: Cannot find module 'ts-node/register'
cluster mode is not yet implemented in bun
Not anymore. See: https://bun.sh/blog/bun-v1.1.25#node-cluster-support
i think we should migrate to run always in bun by default if installed
Hi all, I find a workaround. https://github.com/Unitech/pm2/issues/5893#issuecomment-2395029376
You can run it with
bun --bun pm2 start
.
this results for me in error: Script not found "pm2"
I had to perform bun --bun run pm2 start index.ts
Full Bun support is available in beta, please could you try it and report me any bugs:
bun install pm2-beta -g
pm2 update
Thanks
pm2 logs uses 30% of resources of my machine, im using it on a potato but a bun version would be great