LinuxCommandLibrary

npm-team

Manage npm organization teams and memberships

TLDR

Add a user to a team in an organization

$ npm team add [organization:team] [username]
copy

Remove a user from a team
$ npm team rm [organization:team] [username]
copy

Create a new team in an organization
$ npm team create [organization:team]
copy

Delete a team from an organization
$ npm team destroy [organization:team]
copy

List all teams in an organization
$ npm team ls [organization]
copy

List all users in a specific team
$ npm team ls [organization:team]
copy

SYNOPSIS

npm team <subcommand> [options]

PARAMETERS

add <scope:team> <user>
    Adds a user to a specified team within an organization.

create <scope:team>
    Creates a new team within an organization.

destroy <scope:team>
    Destroys (deletes) an existing team within an organization.

ls [<scope>|<scope:team>]
    Lists all teams within an organization, or all members of a specific team.

rm <scope:team> <user>
    Removes a user from a specified team within an organization.

DESCRIPTION

The npm team command is a crucial tool for managing access control and collaboration within npm organizations. It allows organization administrators to create, destroy, and modify teams, as well as add or remove users from these teams. Teams provide a granular way to assign permissions to private npm packages, ensuring that only authorized users or CI/CD systems have access to sensitive code. By structuring members into teams, administrators can efficiently manage permissions across multiple packages without individually adjusting each user's access rights. This command integrates directly with the npm registry's organization features, streamlining team-based development workflows and enhancing security for proprietary or internal package sharing. It is commonly used in enterprise and team development environments where shared private modules are prevalent.

CAVEATS

All npm team operations require the user to be an administrator of the target npm organization. Authentication via npm login is necessary before executing commands. The specified <scope> must correspond to an existing npm organization. Team management features are specific to the npm registry and not directly applicable to other package registries without explicit support.

PERMISSIONS AND SCOPE

All npm team operations require the user to be an administrator of the target npm organization. The <scope> argument refers to the organization's name (e.g., @myorg), and <team> refers to the team's slug within that organization (e.g., developers). The full team identifier is typically <scope>:<team>. These commands primarily interact with the npm registry, affecting permissions for private packages owned by the organization.

INTEGRATION WITH NPM ACCESS

Teams created and managed with npm team can be used directly with npm access to grant or revoke read/write access to private packages for an entire group of users, rather than managing permissions user by user. For example, to grant a team write access to a package: npm access grant read-write <scope:team> <package-name>.

HISTORY

The concept of organizations and teams was introduced to the npm CLI with npm@2.0.0, released in October 2014. The npm team command was specifically designed to provide a dedicated interface for managing these new access control features, enhancing the capabilities for large-scale and enterprise development. It has since been a stable part of the npm CLI, evolving alongside other access management commands like npm access.

SEE ALSO

npm access(1), npm owner(1), npm org(1), npm login(1)

Copied to clipboard