Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Fix graphql-lsp #67

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix graphql-lsp #67

wants to merge 1 commit into from

Conversation

ranayas
Copy link

@ranayas ranayas commented May 19, 2021

graphql-lsp binary needs the graphql package in order to execute, otherwise it throws "Error: Cannot find module 'graphql'"

graphql-lsp binary needs the graphql package in order to execute, otherwise it throws "Error: Cannot find module 'graphql'"
@kabouzeid
Copy link
Owner

Thanks, will look into it

@kabouzeid
Copy link
Owner

kabouzeid commented May 22, 2021

strange, it works for me without this.

@kabouzeid
Copy link
Owner

could you share a minimal gql sample project with me, so that we are on the same page?

@ranayas
Copy link
Author

ranayas commented May 23, 2021

I have two files for this test: graphqlrc.yml and schema.graphql.

image

This is the log:

[ START ] 2021-05-23T14:56:54-0500 ] LSP logging initiated
[ ERROR ] 2021-05-23T14:57:02-0500 ] ...nt_nvim2rEms2/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]	"rpc"	"/home/xirius/.local/share/nvim/lspinstall/graphql/./node_modules/.bin/graphql-lsp"	"stderr"	"internal/modules/cjs/loader.js:888\n  throw err;\n  ^\n\nError: Cannot find module 'graphql'\nRequire stack:\n- /home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/client.js\n- /home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/cli.js\n- /home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/bin/graphql.js\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)\n    at Function.Module._load (internal/modules/cjs/loader.js:730:27)\n    at Module.require (internal/modules/cjs/loader.js:957:19)\n    at require (internal/modules/cjs/helpers.js:88:18)\n    at Object.<anonymous> (/home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/client.js:8:19)\n    at Module._compile (internal/modules/cjs/loader.js:1068:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)\n    at Module.load (internal/modules/cjs/loader.js:933:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:774:14)\n    at Module.require (internal/modules/cjs/loader.js:957:19) {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: [\n    '/home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/client.js',\n    '/home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/cli.js',\n    '/home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/bin/graphql.js'\n  ]\n}\n"

Then, If I execute ./graphql-lsp binary directly from ~/.local/share/nvim/lspinstall/graphql/, I get the same error:

internal/modules/cjs/loader.js:888
  throw err;
  ^

Error: Cannot find module 'graphql'
Require stack:
- /home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/client.js
- /home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/cli.js
- /home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/bin/graphql.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/client.js:8:19)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/client.js',
    '/home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/dist/cli.js',
    '/home/xirius/.local/share/nvim/lspinstall/graphql/node_modules/graphql-language-service-cli/bin/graphql.js'
  ]
}

Finally, if I execute npm install graphql in ~/.local/share/nvim/lspinstall/graphql it works correctly.

image

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

Successfully merging this pull request may close these issues.

None yet

2 participants