How to Fix spawnSync graphql ENOENT in Prisma

I was playing around with prisma and had an issue in the post-deploy

<code class="language-yml">endpoint: ${env:PRISMA_ENDPOINT}
datamodel: datamodel.prisma
# secret: ${env:PRISMA_SECRET}
hooks:
  post-deploy:
      - graphql get-schema -p prisma

Basically, I was generating schema after the Prisma is deployed using post-deploy hooks.

It turns out the reason for the issue is because I didn’t have graphql-cli installed on my machine globally.

Just after installing that package. The above issue got resolved.

<code class="language-bash">npm i -g graphql-cli