Skip to main content

Installation

This page collects the prerequisites and installation options for @pagopa/dx-cli.

Requirements​

The following tools must be installed on your machine:

ToolVersion
Node.js>= 22.0.0
Terraform or tfenvlatest
miselatest
GitHub CLIlatest
Azure CLIlatest (required for Azure environments only)

dx init checks for mise before scaffolding the repository, then uses it to lock and install the generated toolchain before installing the workspace dependencies.

GitHub Packages access

Generated repositories depend on the DX Nx plugins, which are published to GitHub Packages. The GitHub token used by the CLI must include the read:packages scope: if you authenticated with the GitHub CLI, add it with:

gh auth refresh --scopes read:packages

Alternatively, set GH_TOKEN or GITHUB_TOKEN to a personal access token that includes the read:packages scope.

dx init verifies the token against GitHub Packages before scaffolding, so a missing scope fails before anything is generated instead of halfway through the bootstrap.

dx init stores the resolved token in a git-ignored .npmrc inside the generated repository, so later local installs keep working.

Before running any command that interacts with GitHub or a cloud provider, ensure you are logged in:

gh auth login
az login
GitHub authentication is mandatory

Every command except --version and --help requires GitHub authentication. The CLI resolves credentials in this order: the GH_TOKEN environment variable, the GITHUB_TOKEN environment variable, then the GitHub CLI (gh auth login). If none is available, the command exits with an error asking you to log in.

Telemetry is collected only for members of the pagopa GitHub organization; everyone else can use the CLI normally with telemetry disabled.

Azure session expiry

Within PagoPA, az login sessions expire every 12 hours. If a command fails with an authentication error, run az login again before retrying.

Installation​

You can invoke the CLI directly via npx without installing globally:

npx @pagopa/dx-cli --help

When installed locally in a monorepo you can also run:

pnpm dx --help

The binary name is dx.