LinuxCommandLibrary

npm-org

Manage npm organizations and teams

TLDR

Add a new user to an organization

$ npm org set [organization_name] [username]
copy

Change a user's role in an organization
$ npm org set [organization_name] [username] [developer|admin|owner]
copy

Remove a user from an organization
$ npm org rm [organization_name] [username]
copy

List all users in an organization
$ npm org ls [organization_name]
copy

List all users in an organization, output in JSON format
$ npm org ls [organization_name] --json
copy

Display a user's role in an organization
$ npm org ls [organization_name] [username]
copy

SYNOPSIS

The primary syntax for npm org involves a subcommand to specify the desired action.

npm org <command>

Common <command> options include:

npm org ls [<orgname>]
npm org add <orgname> <username> [<role>]
npm org rm <orgname> <username>
npm org set <orgname> <key> <value>
npm org enable-public-signup <orgname>
npm org disable-public-signup <orgname>

PARAMETERS

--json
    Outputs data in JSON format for programmatic use.

--otp
    Provides a one-time password from a two-factor authenticator, required for certain registry operations.

--registry
    Specifies the base URL of the npm registry to use, overriding the default configured registry.

orgname
    The name of the npm organization to manage.

username
    The npm username of the member to add or remove from an organization.

role
    The role to assign to a new member (e.g., developer or admin). Defaults to developer.

key
    The configuration key to set for an organization (e.g., public-signup).

value
    The value to assign to a configuration key (e.g., true or false).

DESCRIPTION

npm org is a powerful subcommand within the npm command-line interface, designed for managing organizations on the npm registry. Organizations provide a structured way to group collaborators and packages, enabling enhanced control over access permissions, especially crucial for larger development teams or companies. This command facilitates several key operations related to organization management, such as adding or removing members, listing organization details, and enabling/disabling public sign-ups. It integrates with the npm-team command to provide more granular control over package access for specific groups of users within an organization. Utilizing npm org helps maintain clear administrative oversight and efficient collaboration when working with private or public packages under a collective entity on npm.

CAVEATS

Requires an authenticated npm session. Administrative actions typically require admin privileges within the organization. Commands involving registry changes may require a one-time password (--otp) if two-factor authentication is enabled for your account.
Network connectivity is essential for interacting with the npm registry.

ROLES WITHIN AN ORGANIZATION

When adding a member to an organization, you can specify their role:
developer: Can publish packages to teams they are part of.
admin: Has full administrative control over the organization, including adding/removing members and managing teams.

INTEGRATION WITH NPM-TEAM

While npm org manages overall organization membership, npm-team provides more granular control. Teams allow you to define subsets of organization members and assign specific permissions to packages for those teams. Use npm org to manage the organization's members, then npm-team to assign members to teams and manage team-specific package access.

HISTORY

The concept of organizations was introduced to the npm registry to cater to the needs of larger development teams and enterprises. This feature provided a robust mechanism for collaborative package development and granular access control, particularly for private packages. The npm org command evolved as the primary interface for managing these organizational structures, complementing the existing user and package management commands within the npm CLI.

SEE ALSO

Copied to clipboard