Registry / devops / graphql-language-service-cli

graphql-language-service-cli

JSON →
library3.5.0jsnpmunverified

The GraphQL Language Service CLI provides a command-line interface for the GraphQL language server protocol implementation, enabling IDE-like features such as autocompletion, validation, hover info, and diagnostics for GraphQL schemas and operations. Version 3.5.0 supports GraphQL 15, 16, and 17 alpha; it is part of the GraphiQL ecosystem and offers a standalone CLI server that can be integrated with code editors. Unlike the full language server, the CLI is designed for scripting and development workflows, with support for file-based schema loading and GraphQL configuration files.

npm install graphql-language-service-cli
INSTALL
IMPORT
SIG · GRAPHQL-LANGUAGE-S
G
graphql-language-service-cli
devopsjavascriptv3.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

startServer
import { startServer } from 'graphql-language-service-cli'
const { startServer } = require('graphql-language-service-cli')
This package is ESM-only; server-style import.
GraphQLLanguageService
import { GraphQLLanguageService } from 'graphql-language-service-cli'
import { LanguageService } from 'graphql-language-service'
Main class for the language service; note the full name.
getAutocompleteSuggestions
import { getAutocompleteSuggestions } from 'graphql-language-service-cli'
import { getAutocompleteSuggestions } from 'graphql-language-service-interface'
Utility function exposed via CLI package; direct import correct.

Starts a GraphQL Language Server that provides autocompletion and validation via a socket connection, loading schema from a file.

import { startServer } from 'graphql-language-service-cli'; // Start language server on default port with a schema file startServer({ port: 3000, schemaPath: './schema.graphql', method: 'socket', }).then(() => { console.log('GraphQL Language Server running on port 3000'); });
Debug
Known issues
breakingESM-only since v3: This package no longer supports CommonJS require(). Use dynamic import() if needed.
fix
Switch to 'import' syntax; if CommonJS required, use dynamic import: const { startServer } = await import('graphql-language-service-cli')
affects: >=3.0.0
deprecatedDeprecated option 'schemaPath' in favor of 'loadConfig' config.
fix
Use loadConfig with schema property: loadConfig({schema: '...'}).
affects: >=3.2.0
gotchaGraphQL peer dependency required: Must have graphql installed as a peer dependency.
fix
Install graphql: npm install graphql
affects: >=3.0.0
gotchaSocket method only on desktop environments: The 'socket' method may not work in browsers or limited environments.
fix
Use 'stdio' method for cross-platform compatibility.
affects: >=1.0.0
breakingRemoved support for GraphQL v14 in v3.0.0.
fix
Upgrade GraphQL to ^15.5.0 || ^16.0.0 || ^17.0.0-alpha.2.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'graphql-language-service-cli'
Package not installed or import path incorrect.
fix
Run 'npm install graphql-language-service-cli' and ensure import uses correct name.
TypeError: startServer is not a function
Wrong import style — expected named import but used default import.
fix
Use correct import: import { startServer } from 'graphql-language-service-cli'
Error: GraphQL Language Server requires a schema file
Missing 'schemaPath' or 'loadConfig' option.
fix
Provide schemaPath: './schema.graphql' or use loadConfig with schema definition.
Error: listen EADDRINUSE :::3000
Port already in use by another process.
fix
Change port or kill the process using the port.
Upgrade
Version history
3.5.0latest on npm
Audit
Dependencies
graphqlrequiredPeer dependency for GraphQL schema and language features
Agent activity
6 hits · last 30 days
node
6
Resources
graphql-language-service-cli — npm install graphql-language-service-cli · libregistry