You can use PM2 with Bun in two ways: as a CLI option or in a configuration file.
With --interpreter
To start your application with PM2 and Bun as the interpreter, run:
terminal
With a configuration file
Alternatively, create a file namedpm2.config.js in your project directory and add the following content.
pm2.config.js
After saving the file, start your application with PM2.
terminal
Your JavaScript/TypeScript web server now runs as a daemon with PM2, using Bun as the interpreter.