spawnSync graphql ENOENT error -- prisma post-deployment hooks not running


#1

Hello,

I’m going through the graphql-node tutorial and getting the following error when I run prisma deploy:

    post-deploy:
    spawnSync graphql ENOENT
    Running graphql get-schema --project foo ×

Here is my .graphqlconfig.yml:

projects:
  app:
    schemaPath: "src/schema.graphql"
    extensions:
      endpoints:
        default: "http://localhost:4000"
  database:
    schemaPath: "src/generated/prisma.graphql"
    extensions:
      prisma: database/prisma.yml

And this is my prisma.yml:

datamodel: datamodel.graphql
endpoint: https://us1.prisma.sh/jon-moore-9ffc3c/foo/bar
secret: mysecret123
hooks:
  post-deploy:
    - graphql get-schema --project foo

I am using Windows and running the commands in the Git CLI. I tried the same thing using Linux and had no issues, however I need to know how to do this is Windows for work. Any input is greatly appreciated. Thanks.


#2

I was having the same issue until i installed the graphql-cli package:
npm i -g graphql-cli

I hope this helps you!


#3

I’m still having this issue despite installing the graphql-cli globally.


#4

For anyone else who is still having this issue despite installing graphql-cli, it looks like there’s also a windows specific issue that requires special syntax for post deployment hooks - I added .cmd to graphql, and it works now!

For example, if you have graphql get-schema in your hooks, replace it with graphql.cmd get-schema, and you’re good!!