My deploy failed and I believe it is from package.json scripts

I have deployed a number of applications on Netlify without any issues. But this is the first time I am deploying one with an external database. It works well locally, but when I get it on Netlify the build fails with a “build exceeded maximum allowed runtime” error.

I usually run it locally with “npm run dev” script. I suppose I need to create a build script in package.json, but not sure how to make it work with the “npm run dev” so that the client side will remain in sync.

This is the current state of my package.json

“scripts”: {
“start”: “node server/server.js”,
“backend”: “nodemon server/server.js”,
“frontend”: “npm run start --prefix client”,
“dev”: “concurrently "npm run backend" "npm run start --prefix client"”

My question is: if I should add a “build”: “npm run dev” in the json file, then use “npm run build” in Netlify, will that resolve the error?


It’s not about what the script is called, it’s about what it does.

What you suggest would just result in:

npm run build ->
npm run dev ->
concurrently "npm run backend" "npm run start --prefix client

Your application needs to have a command/script that produces static output.

If you need to host your own server, then you won’t be able to host with Netlify.