I’m encountering an issue with my deployment on Vercel. I’ve configured my vercel.json file to run a custom build command using “buildCommand”: npm run build, but it seems like the npm run build command is not being executed during deployment.

Here’s my vercel.json configuration:

{
  "version": 2,
  "buildCommand": "npm run build",
  "builds": [
    {
      "src": "src/index.ts",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "src/index.ts"
    }
  ]
}

And here’s the relevant part of my package.json:

{
  "scripts": {
    "build": "npm run clean && tsc && tsc-alias"
  }
}

I’ve confirmed that the npm run build command works correctly locally, but it doesn’t seem to be executed during deployment on Vercel. Is there something I’m missing in my configuration, or is there a different approach I should take to run custom build commands on Vercel?

Any help or insights would be greatly appreciated. Thank you!

It should run without any problems and errors like this:

Cannot find module '@middlewares/index'
Require stack:
- /var/task/server/src/router.js
- /var/task/server/src/utils/app.utils.js
- /var/task/server/src/utils/index.js
- /var/task/server/src/index.js
Did you forget to add it to "dependencies" in `package.json`?
INIT_REPORT Init Duration: 1498.57 ms   Phase: invoke   Status: error   Error Type: Runtime.ExitError
Error: Runtime exited with error: exit status 1