Laravel graphql lighthouse not working properly

326 Views Asked by At

I am using GraphQL Lighthouse for Laravel 10 project for the first time and I stuck in first phase of API.

I exactly do what documentation said Link Here and YouTube tutorial

  • Install lighthouse package

    composer require nuwave/lighthouse

  • Publish the default schema

    php artisan vendor:publish --tag=lighthouse-schema

  • IDE Support

    php artisan lighthouse:ide-helper

  • Install GraphQL DevTools

    composer require mll-lab/laravel-graphiql

After that when I hit my project e.g.

http://localhost/laravel-light-graph/graphiql

It gives me this error:

{
  "errors": [
    {
      "message": "Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON",
      "stack": "SyntaxError: Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON"
    }
  ]
}

enter image description here

Note: I install this package on fresh Laravel

I didn't write a single line of code for create apis or schema and can't go further from documentation.

I don't know what to do, I searched a lot but didn't get any help. So please guide me on this.

0

There are 0 best solutions below