#errors with pm2 + bun
2 messages · Page 1 of 1 (latest)
I'm sorry, but the knowledge sources do not contain explicit information about using PM2 with Bun and the Nitro 'bun' preset in Nuxt, nor do they address the specific error you are encountering with module resolution (e.g., "Cannot find module ...ofetch/dist/node.mjs" when running under PM2 with Bun).
However, the official Nuxt documentation and examples for Docker and deployment with Bun show that running the server directly with Bun (e.g., bun --bun run /app/server/index.mjs or bun .output/server/index.mjs) is supported and works as expected. There is no mention of using PM2 as a process manager for Bun in these examples—PM2 is typically shown with Node.js as the interpreter, not Bun. This suggests that using PM2 with Bun may not be officially supported or tested, and could lead to issues with module resolution or environment setup, as you are experiencing. Running the server directly with Bun works, which matches the documented approach for Bun deploymentsDeploy with Docker.
If you need process management for Bun, you may need to look for Bun-specific solutions or run Bun directly as shown in the official deployment examples. If you want to use PM2, the knowledge sources only show it with Node.js as the interpreter, not BunNuxt Deployment.
In summary:
- Running Nuxt with Bun directly works and is documented.
- PM2 is documented for use with Node.js, not Bun.
- Your error may be due to unsupported or untested integration between PM2 and Bun.