Prerequisites
Before installing GraphDoc, ensure you have the following installed:- Node.js: Version 10 or higher recommended
- npm: Comes bundled with Node.js
Install with npm (recommended)
The easiest way to use GraphDoc is to install it globally via npm. This makes thegraphdoc command available system-wide.
The package name is
@2fd/graphdoc, but the command is just graphdoc.Global vs local installation
You can also install GraphDoc locally in your project:Run with npx
If you don’t want to install GraphDoc permanently, you can run it directly with npx. This downloads and executes the package in a single command:- One-time documentation generation: When you don’t need GraphDoc installed permanently
- CI/CD pipelines: Ensures you always use the latest version without managing dependencies
- Quick testing: Try GraphDoc without committing to an installation
Install from source
For development or to use the latest unreleased features, you can install GraphDoc from the GitHub repository.Running from source
Without linking, you can run GraphDoc directly from the repository:Available npm scripts in the repository
Available npm scripts in the repository
The GraphDoc repository includes several helpful npm scripts:
npm run compile- Compile TypeScript to JavaScriptnpm run declaration- Generate TypeScript declaration filesnpm test- Run the test suite with Jestnpm run doc.github- Generate GitHub API documentation examplenpm run doc.pokemon- Generate Pokemon API documentation examplenpm run doc.shopify- Generate Shopify API documentation example
Verify installation
Regardless of your installation method, verify that GraphDoc is working correctly:Update GraphDoc
To update to the latest version of GraphDoc:Uninstall GraphDoc
If you need to remove GraphDoc:Troubleshooting
Permission errors during global installation
Permission errors during global installation
On Unix-based systems, you might encounter permission errors when installing globally. You have two options:Option 1: Use npx instead (recommended)Option 2: Fix npm permissions
Follow npm’s official guide to resolve permission issues.
Command not found after installation
Command not found after installation
If
graphdoc command is not found after global installation:-
Verify the installation:
-
Check your npm global bin path is in your PATH:
-
Add npm’s bin directory to your PATH if needed:
TypeScript compilation errors when building from source
TypeScript compilation errors when building from source
Ensure you’re using a compatible TypeScript version:If errors persist, try cleaning and reinstalling:
GraphDoc is an MIT-licensed open-source project. For issues, bug reports, or feature requests, visit the GitHub repository.