graphql-for-vscode
graphql-for-vscode copied to clipboard
getting "graphql language server has stopped" message
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:
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
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.
Have you installed watchman?
It's globally installed.
$ watchman -v
4.7.0
I'm having the same issue... :(
@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"
}
Also having this issue - instructions given definitely dont work. @playlyfe/gql
tells to install globally - this plugin doesnt work unless a dev dependency.
Also having this issue. @abarger-bss 's solution does nothing for me. Is there anybody who solved this issue?
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.
@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.