The `gremlin` package provides the official JavaScript Gremlin Language Variant (GLV) for Apache TinkerPop, enabling developers to interact with any TinkerPop-enabled graph database. Currently stable at version 3.8.1, this driver is actively maintained with typically 3-4 releases per year, often aligning with major/minor TinkerPop versions. It differentiates itself by being the official Apache project, supporting bytecode-based traversals (the recommended approach over string-based scripts for better performance, portability, and security), and runs on Node.js (version 20 and higher) with experimental support for Web APIs. The driver establishes a WebSocket connection to a remote Gremlin Server or a compatible graph provider, translating JavaScript method calls into Gremlin traversals for execution on the server-side.
npm install gremlinVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to establish a connection to a Gremlin Server, create a graph traversal source, execute a simple vertex count, add a new vertex with properties, and then count specific vertices, showcasing fundamental Gremlin operations.
Upgrade to `gremlin` version 3.3.3 or newer. If using an older server with a newer client, explicitly configure the `mimeType` in `DriverRemoteConnection` options to `application/vnd.gremlin-v2.0+json` on the client side, and ensure the server is configured to use GraphSON2.
Design your graph mutations to be idempotent where possible. For complex multi-step updates, consider using server-side transactions if your graph database supports them, or restructure your traversals to fit within single bytecode requests. Avoid relying on explicit client-side transaction management that spans multiple requests unless using Gremlin Server sessions, which should be done with caution.
For query profiling and explanation on AWS Neptune, prefer using Neptune's dedicated `/profile` and `/explain` APIs instead of the Gremlin `profile()` and `explain()` steps.
Avoid `g.V().count()` for general size checks on large production graphs. Instead, use more targeted traversals, maintain a separate count in an external system, or leverage specific graph database features for estimating graph size if available. Use indexed traversals (e.g., `g.V().hasLabel('person').count()`) when counting specific subsets.Ensure your Node.js environment is running version 20 or higher to maintain compatibility with `gremlin` 3.8.x and future releases.
Ensure the Gremlin Server is configured with the expected serializers (e.g., GraphSON3 or GraphBinary) and that the client's `mimeType` option in `DriverRemoteConnection` matches. For specific graph providers like Azure Cosmos DB, ensure necessary authentication and specific `mimeType` settings are applied.
Verify that your Gremlin Server is running and listening on the correct host and port. Check network connectivity and firewall rules. Ensure the `gremlinServerUrl` in your client code is accurate.
Ensure `g` is correctly initialized by chaining `AnonymousTraversalSource.traversal().withRemote(connection)` after establishing a `DriverRemoteConnection`. This pattern creates the fluent traversal source.
This can happen with complex data types or specific traversal steps (like `profile()`) not fully supported by the client's default serializer or the remote graph's capabilities. Check compatibility between your Gremlin driver version, Gremlin Server version, and specific graph database. For AWS Neptune, this error can appear with `profile()` and `explain()` steps.
No dependency data recorded yet.