Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting "graphql language server has stopped" message #115

Open
mogarick opened this issue Oct 4, 2018 · 8 comments
Open

getting "graphql language server has stopped" message #115

mogarick opened this issue Oct 4, 2018 · 8 comments

Comments

@mogarick
Copy link

mogarick commented Oct 4, 2018

I installed this plugin and then gql (yarn --dev add @playlyfe/gql)
Then I created a simple index.js file for a graphql tutorial but the VSCode plugin is not woking.
I'm getting an error indicator:
screen shot 2018-10-04 at 6 06 43 pm
when hover on it the next message displays:
"Graphql language server has stopped"
When I click o it the Graphql for VS Code output console opens with this content:

[Info  - 8:47:24 AM] NODE_PATH value is: /my/user/path/my-graphql-cp
[Info  - 8:47:28 AM] Module '@playlyfe/gql' loaded from: /my/user/path/my-graphql-cp/node_modules/@playlyfe/gql/lib/index.js

Here is the content of my .gqlconfig file

{
   "schema": {
     "files": "schemas/**/*.gql"
   },
   "query": {
     "files": [ /* define file paths which you'd like the gql parser to watch and give autocomplete suggestions for */
       {
         "match": "src/**/*.js", // for js
         "parser": ["EmbeddedQueryParser", { "startTag": "`", "endTag": "`" }]        
       }
     ]
   }
 } 

Here is the contents of my index.js file. the typeDefs is shown as a simple JS String

screen shot 2018-10-04 at 6 15 31 pm

const {GraphQLServer} = require("graphql-yoga");

const typeDefs = `
type Query {
    info: String!
    feed: [Link!]!
}

type Mutation {

}

type Link {
    id: ID!
    description: String!
    url: String!
}
`;

let links = [ {
    id: 'link-0',
    url: 'www.howtographql.com',
    description: 'Full stack tutorial for graphql'
}]


const resolvers = {
    Query: {
        info: () => `GraphQL CP`,
        feed: () => links

    }
    ,
    Link: {
        id: (root) => root.id,
        description: (root) => root.description,
        url: (root) => root.url
    }
}

const server = new GraphQLServer({
    typeDefs,
    resolvers
});

server.start(()=>console.log(`Server is running on http://localhost:4000`));

Is there a problem or do I need to config something else?

Thank you in advance.

@kumarharsh
Copy link
Owner

Have you installed watchman?

@mogarick
Copy link
Author

mogarick commented Oct 5, 2018

It's globally installed.

$ watchman -v
4.7.0

@Aleksion
Copy link

I'm having the same issue... :(

@abarger-bss
Copy link

@Aleksion @mogarick I was also having this issue. I resolved it by adding a package.json to my workspace with npm init and adding @playlyfe/gql (which I had already installed) to its dependencies:

{
  "name": "my-test-schema",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {},
  "devDependencies": {
    "@playlyfe/gql": "^2.6.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

@bradennapier
Copy link

bradennapier commented Dec 7, 2018

Also having this issue - instructions given definitely dont work. @playlyfe/gql tells to install globally - this plugin doesnt work unless a dev dependency.

@ScripterSugar
Copy link

Also having this issue. @abarger-bss 's solution does nothing for me. Is there anybody who solved this issue?

@kumarharsh
Copy link
Owner

I don't have an actual solution, but I believe this could be because vscode is inheriting a different environment than your terminals, which is causing watchman to not be found in the path. I'll look into adding more diagnostics on those edge cases so that it can help you pinpoint issues better.

As a start, are all of you using Macs? I don't have a Mac, but on Windows, this issue occurs sometimes when I have run watchman from an Admin (elevated) Powershell, and have launched vscode via Start menu or from a non-elevated shell.

@kumarharsh
Copy link
Owner

@bradennapier - you should not install @playlyfe/gql globally - it should always be a dev dependency of your project. The instructions never mention installing the dependency globally, they have to be within the workspace root or a subfolder.

I've re-read the readme and might have missed out on such an instruction (or be blind to it!), so if you help me by pointing out where the docs cause you confusion, I can correct it so as not to cause future confusion to others. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants