Chaining release_commands for Node.js. app


I am building an JSON API using Express + Node.js that is backed by Postgres. I’d like to run a migrate command, followed by a seed command (though I don’t really need to run seed on every deploy). If I try to chain commands with &&, I notice the deploy fails. Is there a better way to do this?

  release_command = "npx prisma migrate dev && node dist/seeds/seeds.js"

However, if I run the seed command alone, it suceeds:

  release_command = "node dist/seeds/seeds.js"

Separately, I’d be curious to know if there’s a way to run this from the command line. When I tried to ssh into the console and called node I got back the following error: /bin/sh: 1: node: not found.

If you want to chain commands, run bash:

release_command = "bash -c 'npx prisma migrate dev && node dist/seeds/seeds.js'"

As an alternative, add a “release” script in your “package.json” and run it:

release_command = "yarn run release"

If you shell in, you can find node at /root/.volta/bin. Try running:

export PATH=/root/.volta/bin:$PATH