Registry / devops / hasura-cli

hasura-cli

JSON →
library2.38.0jsnpmunverified

An npm package that automatically installs and wraps the Hasura CLI binary in an isolated manner, currently at v2.38.0. It mirrors the official Hasura CLI releases (Go binary) and is auto-published on new Hasura releases. Key differentiator: it allows per-project installation with different versions, avoiding global binary management and ensuring team consistency. Supports alpha, beta, and latest release channels via npm tags. Requires Node.js >= 16.

npm install hasura-cli
INSTALL
IMPORT
SIG · HASURA-CLI
H
hasura-cli
devopsjavascriptv2.38.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

hasura
✓ npx hasura ...
✗ import hasura from 'hasura-cli'
hasura-cli provides a binary, not a JS module. Use npx or add to scripts in package.json.
default
✓ const { execSync } = require('child_process'); execSync('npx hasura --version');
✗ const hasura = require('hasura-cli');
No default export; the package only installs the binary.
hasura
✓ // In package.json scripts: "hasura": "hasura"
✗ import { hasura } from 'hasura-cli'
Add to npm scripts to use the binary directly; no named export.

Shows installation, version check, project init, and migration apply using the hasura binary via npx.

// 1. Install as devDependency (or globally) npm install --save-dev hasura-cli@latest // 2. Verify installation npx hasura version // 3. Initialize a Hasura project npx hasura init my-project --endpoint https://your-hasura-instance.com // 4. Apply migrations or metadata cd my-project npx hasura migrate apply npx hasura metadata apply
hasura --version
Debug
Known issues
breakingVersioning follows Hasura CLI releases, not semantic versioning of this package. v2.38.0 corresponds to Hasura CLI v2.38.0.
fix
Check Hasura CLI changelog for breaking changes between versions, not this package's changelog.
affects: >=2.0.0
deprecatedInstallation via 'npm install --save-dev hasura-cli' without a tag may install an outdated version if the 'latest' tag is behind.
fix
Always specify a tag or version: 'npm install --save-dev hasura-cli@latest' or 'npm install --save-dev hasura-cli@2.38.0'.
affects: >=1.0.0
gotchaPackage does not expose a JavaScript API; it only provides a binary. Attempting to require('hasura-cli') returns an empty object.
fix
Use the binary via npx, shell scripts, or npm scripts. Do not attempt to import.
affects: >=1.0.0
gotchaBinary download may fail in restricted network environments (e.g., CI with no internet access).
fix
Pre-download the binary and place it at node_modules/.bin/hasura, or set environment variable HASURA_BINARY_PATH to a local path.
affects: >=1.0.0
gotchaAlpha and beta versions may be unstable. The 'alpha' and 'beta' npm tags refer to Hasura's pre-release versions.
fix
Use '@latest' for stable releases unless you need to test pre-release features.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'hasura-cli'
Attempting to require('hasura-cli') in Node.js thinking it's a library.
fix
This is a binary-only package. Use 'npx hasura' or add to scripts.
hasura: command not found
Binary not installed or not in PATH after global install without proper npm prefix.
fix
Reinstall globally: 'npm install -g hasura-cli' or use 'npx hasura'.
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/hasura-cli'
Global install without sudo or incorrect npm prefix on Linux/macOS.
fix
Use 'sudo npm install -g hasura-cli' or configure npm prefix for user.
Error: Failed to download Hasura CLI binary for platform darwin/arm64
Platform detection issue or missing platform support (e.g., Apple Silicon not supported in older versions).
fix
Update to latest version of hasura-cli (>=2.0.0). Alternatively, set environment variable HASURA_BINARY_PATH to a manually downloaded binary.
SyntaxError: Unexpected token '.' in JSON at position 0
Corrupted binary download or incomplete installation.
fix
Delete node_modules and reinstall: 'rm -rf node_modules && npm install'.
Upgrade
Version history
2.38.0latest on npm
Audit
Dependencies
@hasura/clirequiredThis package wraps the official Hasura CLI binary (originally a Go binary) as an npm dependency.
Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
hasura-cli — npm install hasura-cli · libregistry