NPM-STAGE(1)
π npm-stage(1) π
πΈ NAME πΈ
npm-stage β Stage packages for publishing. Periodt. This is the npm-stage(1) manual, bestie, and we're getting into it.
β¨ Synopsis β¨
npm stage
β οΈ Note: This command is unaware of workspaces.
π Description π
Okay so staged publishing lets package maintainers require proof-of-presence for all publishes. Proof-of-presence is where a human is involved, interjects, and provides authentication (2FA) during an action β in this case, publishing an npm package. It's giving "yes, a real person was here" energy.
Typically when maintainers use automated workflows to publish, proof-of-presence is lacking as there's no convenient way to interject the process and provide 2FA, as is the case for publishing with a granular access token with bypass and the trusted publishing flow. Staged publishing allows users to have their automated workflows stage a package without a 2FA prompt, deferring the act of 2FA, allowing the maintainer to approve the staged package and publish at a later point. Iconic, honestly.
The npm stage publish command packs the current working directory and places that version of the package into the registry in a state where it's not available for public access, allowing maintainers to approve the package at a later point in time. The act of staging does not prompt for 2FA and can be done with any token type, the act of approving will. That's the whole vibe.
Key behaviors:
- Staged packages share the same semver version unique index as published packages β you cannot publish a version that already exists as a staged version for that package.
- You can still publish packages normally while you have staged packages pending.
- Staged publishing will allow you to create a new package if it does not exist.
- You can stage multiple versions of the same package.
npm stage publishhas parity withnpm publishand will respect"private": trueinpackage.json, refusing to stage the package.
π Prerequisites π
Before using npm stage commands, ensure the following requirements are met:
- Write permissions on the package: You must have write access to the package you're configuring.
- 2FA enabled on your account: Commands that require 2FA will prompt you to authenticate. If you don't already have 2FA enabled on your account, you must enable it before using these commands.
π¦ Subcommands π¦
npm stage publish [<package-spec>]β Stage a package for publishingnpm stage list [<package-spec>]β List all staged package versionsnpm stage view <stage-id>β View details of a specific staged packagenpm stage approve <stage-id>β Approve a staged package for publishingnpm stage reject <stage-id>β Reject a staged packagenpm stage download <stage-id>β Download the tarball for inspection
π 2FA Requirements by Subcommand π
npm stage publishβ Requires 2FA: No. Notes: Designed for automated workflows; defers 2FA to approval.npm stage listβ Requires 2FA: No. Notes: View staged packages.npm stage viewβ Requires 2FA: No. Notes: View staged package details.npm stage approveβ Requires 2FA: Yes. Notes: Prompts for 2FA to publish the staged package.npm stage rejectβ Requires 2FA: Yes. Notes: Prompts for 2FA to permanently remove the staged package.npm stage downloadβ Requires 2FA: No. Notes: Downloads the tarball for local inspection.
π Tag Behavior π
The --tag flag follows the same logic as npm publish. If no tag is provided, the latest tag is used by default. For pre-release versions (e.g., 1.0.0-beta.1) and non-latest semver versions, the tag must be explicitly provided β otherwise the CLI will error, just as npm publish would. No cap.
The tag is an immutable property of the staged package. Once a package is staged with a given tag, the tag cannot be changed. If you need to stage the same version with a different tag, you must first reject the existing staged package using npm stage reject and then re-stage it with the desired tag.
β Token Behavior β
The key difference with staged publishing is that npm stage publish never requires a 2FA prompt, regardless of token type. This is what makes it suitable for automated workflows. The goal of npm stage publish is deferring proof-of-presence to a later point in time.
- GAT with bypass β
npm stage publish: Can stage.npm publish: Can publish (if allowed by package publishing access). - GAT without bypass β
npm stage publish: Can stage.npm publish: 2FA prompt (if allowed by package publishing access). - Session token β
npm stage publish: Can stage.npm publish: 2FA prompt. - Trust token (OIDC) β
npm stage publish: Can stage (if allowed).npm publish: Can publish (if allowed).
π«Ά Trust Relationship Permissions π«Ά
With staged publishing, trust relationships now support granular command permissions. Shortlived tokens issued through trust relationships can only be used with npm stage publish and npm publish. Shortlived tokens cannot run npm stage subcommands.
npm trust <provider> supports --allow-publish and --allow-stage-publish to control which commands are available through each trust relationship.
π Best Practices π
Note: The addition of staged publishing does not make your account or org more secure. Maintainers must still use the best practices listed below.
- Delete Granular Access Tokens (GAT) with bypass 2FA enabled. Now with staged publishing, we've eliminated the need for a GAT token that can bypass 2FA. We encourage you to delete all your tokens with bypass enabled and switch to using a trust relationship in your automated workflows, or create a GAT without bypass and use
npm stage publish. - Disallow tokens from publishing at the package level. All packages have their own access controls under
"package access"allowing packages to be published with bypass tokens, which is no longer a necessity. We encourage you to select"Require two-factor authentication and disallow tokens (recommended)"for all your packages on the package access page. - Configure trust relationship permissions to prevent
npm publish. We encourage you to only enablenpm stage publishon your trust relationships and disablenpm publish.
π CONFIGURATION π
π npm stage publish π
Stage a package for publishing, deferring proof-of-presence (2FA) to a later point in time.
β¨ Synopsis β¨
npm stage publish <package-spec>
π Flags π
--tagβ Default:"latest". Type: String. If you ask npm to install a package and don't tell it a specific version, then it will install the specified tag. It is the tag added to thepackage@versionspecified in thenpm dist-tag addcommand, if no explicit tag is given. When used by thenpm diffcommand, this is the tag used to fetch the tarball that will be compared with the local files by default. If used in thenpm publishcommand, this is the tag that will be added to the package submitted to the registry.--accessβ Default:'public' for new packages, existing packages it will not change the current level. Type:null, "restricted", "public", or "private". If you do not want your scoped package to be publicly viewable (and installable) set--access=restricted. Unscoped packages cannot be set to restricted. Note: This defaults to not changing the current access level for existing packages. Specifying a value ofrestrictedorpublicduring publish will change the access for an existing package the same way thatnpm access set statuswould. The valueprivateis an alias forrestricted.--dry-runβ Default:false. Type: Boolean. Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg,install,update,dedupe,uninstall, as well aspackandpublish. Note: This is NOT honored by other network related commands, egdist-tags,owner, etc.--otpβ Default:null. Type:null or String. This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions withnpm access. If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.--workspace,-wβ Default: (blank). Type: String (can be set multiple times). Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. Valid values for the workspace config are either:- Workspace names
- Path to a workspace directory
- Path to a parent workspace directory (will result in selecting all workspaces within that folder)
When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
--workspacesβ Default:null. Type:null or Boolean. Set totrueto run the command in the context of all configured workspaces. Explicitly setting this tofalsewill cause commands likeinstallto ignore workspaces altogether. When not set explicitly:- Commands that operate on the
node_modulestree (install,update, etc.) will link workspaces into thenode_modulesfolder. - Commands that do other things (
test,exec,publish, etc.) will operate on the root project, unless one or more workspaces are specified in theworkspaceconfig.
- Commands that operate on the
--include-workspace-rootβ Default:false. Type: Boolean. Include the workspace root when workspaces are enabled for a command. Whenfalse, specifying individual workspaces via theworkspaceconfig, or all workspaces via theworkspacesflag, will cause npm to operate only on the specified workspaces, and not on the root project.--provenanceβ Default:false. Type: Boolean. When publishing from a supported cloud CI/CD system, the package will be publicly linked to where it was built and published from. When theprovenance-fileconfig is set, it takes precedence and automatic provenance generation (including via trusted publishing/OIDC) is skipped.
π npm stage list π
List all staged package versions.
β¨ Synopsis β¨
npm stage list [<package-spec>]
π Flags π
--jsonβ Default:false. Type: Boolean. Whether or not to output JSON data, rather than the normal output.- In
npm pkg setit enables parsing set values withJSON.parse()before saving them to yourpackage.json. Not supported by all npm commands.
- In
--registryβ Default:"https://registry.npmjs.org/". Type: URL. The base URL of the npm registry.
π npm stage view π
View details of a specific staged package.
β¨ Synopsis β¨
npm stage view <stage-id>
π Flags
okay bestie these are the flags hanging out on the main npm stage vibe β here's the whole lineup, no cap:
--jsonβ default isfalse, type isBooleanβ¨ This one decides whether you get JSON data out instead of the normal output. And like, extra detail: innpm pkg setit turns on parsing set values withJSON.parse()before saving them into yourpackage.json. Heads up though β not all npm commands support this one, so don't come for me if it ghosts you.--registryβ default is"https://registry.npmjs.org/", type isURLπ This is literally the base URL of the npm registry. That's it. That's the whole thing.
π npm stage approve
Approve a staged package and publish it to the npm registry β the ultimate "yes bestie, go off" moment π
Synopsis
npm stage approve <stage-id>
Flags
--otpβ default isnull, type isnullorStringπ₯ This is a one-time password from a two-factor authenticator. You need it when publishing or changing package permissions withnpm access. If it's not set and the registry throws back a challenge asking for a one-time password, npm will just prompt you on the command line for one β so no stress, it's got you.--registryβ default is"https://registry.npmjs.org/", type isURLπΈ The base URL of the npm registry. Iconic, we know her.
π npm stage reject
Reject a staged package, and it gets removed from the registry. it's giving "we're not doing this today" π
Synopsis
npm stage reject <stage-id>
Flags
--otpβ default isnull, type isnullorStringπ¦ One-time password from a two-factor authenticator. Needed when publishing or changing package permissions withnpm access. If it's not set and a registry response fails with a challenge for a one-time password, npm prompts you on the command line for one. Same energy as approve, fr.--registryβ default is"https://registry.npmjs.org/", type isURLπ Base URL of the npm registry. Still her.
π npm stage download
Download the tarball of a staged package so you can inspect it β literally the "let me look at it before I commit" main character move π
Synopsis
npm stage download <stage-id>
Flags
--jsonβ default isfalse, type isBooleanβ Whether or not to output JSON data rather than the normal output. Bonus lore: innpm pkg setit enables parsing set values withJSON.parse()before saving them to yourpackage.json. Also worth knowing β it's not supported by all npm commands.--registryβ default is"https://registry.npmjs.org/", type isURLπ The base URL of the npm registry. Yes, again. She's everywhere.
π See Also
npm help publishnpm help unpublishnpm help trust
and that's the whole page, bestie β you ate that π β¨ go forth and stage responsibly π«Ά
this was NPM@12.2.1, dated October 2026, page NPM-STAGE(1) β mwah, ilysm, bye π
π¦ where this page comes from
- arch rolling: npm 12.2.1-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms