{"id":18410,"library":"hasura-cli","title":"hasura-cli","description":"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.","status":"active","version":"2.38.0","language":"javascript","source_language":"en","source_url":"https://github.com/jjangga0214/hasura-cli","tags":["javascript","hasura","hasura-cli","hasura/cli","hasuracli","hasura/graphql-engine","hasura/graphql-engine/cli","hasura/graphql-engine-cli","hasura-graphql"],"install":[{"cmd":"npm install hasura-cli","lang":"bash","label":"npm"},{"cmd":"yarn add hasura-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add hasura-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This package wraps the official Hasura CLI binary (originally a Go binary) as an npm dependency.","package":"@hasura/cli","optional":false}],"imports":[{"note":"hasura-cli provides a binary, not a JS module. Use npx or add to scripts in package.json.","wrong":"import hasura from 'hasura-cli'","symbol":"hasura","correct":"npx hasura ..."},{"note":"No default export; the package only installs the binary.","wrong":"const hasura = require('hasura-cli');","symbol":"default","correct":"const { execSync } = require('child_process'); execSync('npx hasura --version');"},{"note":"Add to npm scripts to use the binary directly; no named export.","wrong":"import { hasura } from 'hasura-cli'","symbol":"hasura","correct":"// In package.json scripts: \"hasura\": \"hasura\""}],"quickstart":{"code":"// 1. Install as devDependency (or globally)\nnpm install --save-dev hasura-cli@latest\n\n// 2. Verify installation\nnpx hasura version\n\n// 3. Initialize a Hasura project\nnpx hasura init my-project --endpoint https://your-hasura-instance.com\n\n// 4. Apply migrations or metadata\ncd my-project\nnpx hasura migrate apply\nnpx hasura metadata apply","lang":"javascript","description":"Shows installation, version check, project init, and migration apply using the hasura binary via npx."},"warnings":[{"fix":"Check Hasura CLI changelog for breaking changes between versions, not this package's changelog.","message":"Versioning follows Hasura CLI releases, not semantic versioning of this package. v2.38.0 corresponds to Hasura CLI v2.38.0.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always specify a tag or version: 'npm install --save-dev hasura-cli@latest' or 'npm install --save-dev hasura-cli@2.38.0'.","message":"Installation via 'npm install --save-dev hasura-cli' without a tag may install an outdated version if the 'latest' tag is behind.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use the binary via npx, shell scripts, or npm scripts. Do not attempt to import.","message":"Package does not expose a JavaScript API; it only provides a binary. Attempting to require('hasura-cli') returns an empty object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pre-download the binary and place it at node_modules/.bin/hasura, or set environment variable HASURA_BINARY_PATH to a local path.","message":"Binary download may fail in restricted network environments (e.g., CI with no internet access).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use '@latest' for stable releases unless you need to test pre-release features.","message":"Alpha and beta versions may be unstable. The 'alpha' and 'beta' npm tags refer to Hasura's pre-release versions.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"This is a binary-only package. Use 'npx hasura' or add to scripts.","cause":"Attempting to require('hasura-cli') in Node.js thinking it's a library.","error":"Cannot find module 'hasura-cli'"},{"fix":"Reinstall globally: 'npm install -g hasura-cli' or use 'npx hasura'.","cause":"Binary not installed or not in PATH after global install without proper npm prefix.","error":"hasura: command not found"},{"fix":"Use 'sudo npm install -g hasura-cli' or configure npm prefix for user.","cause":"Global install without sudo or incorrect npm prefix on Linux/macOS.","error":"Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/hasura-cli'"},{"fix":"Update to latest version of hasura-cli (>=2.0.0). Alternatively, set environment variable HASURA_BINARY_PATH to a manually downloaded binary.","cause":"Platform detection issue or missing platform support (e.g., Apple Silicon not supported in older versions).","error":"Error: Failed to download Hasura CLI binary for platform darwin/arm64"},{"fix":"Delete node_modules and reinstall: 'rm -rf node_modules && npm install'.","cause":"Corrupted binary download or incomplete installation.","error":"SyntaxError: Unexpected token '.' in JSON at position 0"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}