Search code examples
node.jsexpresspm2

Error when using pm2 Interpreter bun is NOT AVAILABLE in PATH


I have installed express and typescript and run my application and works. Now I want to use it with pm2 but I got this error: "Interpreter bun is NOT AVAILABLE in PATH."

PS C:\psm-solution> yarn dev
yarn run v1.22.21
$ pm2 start ts-node-dev src/server.ts
[PM2] Starting C:\PSM-SOLUTION\NODE_MODULES\.BIN\TS-NODE-DEV.CMD in fork_mode (1 instance)
[PM2] Done.
[PM2][ERROR] Interpreter bun is NOT AVAILABLE in PATH. (type 'which bun' to double check.)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What I am doing wrong ?

here is my package.json file

{
  "name": "my app",
  "version": "1.0.0",
  "main": "server.ts",
  "author": "aut",
  "license": "MIT",
  "scripts": {
    "build": "npx tsc",
    "start": "node dist/index.js",
    "dev": "pm2 start ts-node-dev src/server.ts"
  },
  "dependencies": {
    "express": "^4.18.2",
    "uuidv4": "^6.2.13"
  },
  "devDependencies": {
    "@types/express": "^4.17.21",
    "@types/node": "^20.11.7",
    "ts-node": "^10.9.2",
    "ts-node-dev": "^2.0.0",
    "typescript": "^5.3.3"
  }
}


Solution

  • Apparently, you seems to use the bun javascript interpreter instead of node.js.

    you should just locate your bun executable and add it to your user or system path on your windows box.

    Once done, you can try launching your task in PM2 again.

    If you can't find bun executable, verify you have already install it. If not install it.