dependabot/npm_and_yarn/main/proc-log-7.0.0
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-access |
| 3 | section: 1 |
| 4 | description: Set access level on published packages |
| 5 | github_repo: npm/cli |
| 6 | github_branch: latest |
| 7 | github_path: docs/lib/content/commands/npm-access.md |
| 8 | redirect_from: |
| 9 | - /cli-commands/access |
| 10 | - /cli-commands/npm-access |
| 11 | - /cli-documentation/access |
| 12 | - /cli-documentation/cli-commands/access |
| 13 | - /cli-documentation/cli-commands/npm-access |
| 14 | - /cli-documentation/commands/access |
| 15 | - /cli-documentation/commands/npm-access |
| 16 | - /cli-documentation/npm-access |
| 17 | - /cli-documentation/v11/access |
| 18 | - /cli-documentation/v11/cli-commands/access |
| 19 | - /cli-documentation/v11/cli-commands/npm-access |
| 20 | - /cli-documentation/v11/commands/access |
| 21 | - /cli-documentation/v11/commands/npm-access |
| 22 | - /cli-documentation/v11/npm-access |
| 23 | - /cli/access |
| 24 | - /cli/cli-commands/access |
| 25 | - /cli/cli-commands/npm-access |
| 26 | - /cli/commands/access |
| 27 | - /cli/commands/npm-access |
| 28 | - /cli/npm-access |
| 29 | - /cli/v11/access |
| 30 | - /cli/v11/cli-commands/access |
| 31 | - /cli/v11/cli-commands/npm-access |
| 32 | - /cli/v11/commands/access |
| 33 | - /cli/v11/npm-access |
| 34 | - /commands/access |
| 35 | - /commands/npm-access |
| 36 | --- |
| 37 | |
| 38 | ### Synopsis |
| 39 | |
| 40 | ```bash |
| 41 | npm access list packages [<user>|<scope>|<scope:team>] [<package>] |
| 42 | npm access list collaborators [<package> [<user>]] |
| 43 | npm access get status [<package>] |
| 44 | npm access set status=public|private [<package>] |
| 45 | npm access set mfa=none|publish|automation [<package>] |
| 46 | npm access grant <read-only|read-write> <scope:team> [<package>] |
| 47 | npm access revoke <scope:team> [<package>] |
| 48 | ``` |
| 49 | |
| 50 | Note: This command is unaware of workspaces. |
| 51 | |
| 52 | ### Description |
| 53 | |
| 54 | Used to set access controls on private packages. |
| 55 | |
| 56 | For all of the subcommands, `npm access` will perform actions on the packages in the current working directory if no package name is passed to the subcommand. |
| 57 | |
| 58 | - grant / revoke: Add or remove the ability of users and teams to have read-only or read-write access to a package. |
| 59 | |
| 60 | ### Details |
| 61 | |
| 62 | `npm access` always operates directly on the current registry, configurable from the command line using `--registry=<registry url>`. |
| 63 | |
| 64 | Unscoped packages are _always public_. |
| 65 | |
| 66 | Scoped packages _default to restricted_, but you can either publish them as public using `npm publish --access=public`, or set their access as public using `npm access set status=public` after the initial publish. |
| 67 | |
| 68 | You must have privileges to set the access of a package: |
| 69 | |
| 70 | - You are an owner of an unscoped or scoped package. |
| 71 | - You are a member of the team that owns a scope. |
| 72 | - You have been given read-write privileges for a package, either as a member of a team or directly as an owner. |
| 73 | |
| 74 | If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the `--otp=...` option to specify it on the command line. |
| 75 | |
| 76 | If your account is not paid, then attempts to publish scoped packages will fail with an HTTP 402 status code (logically enough), unless you use `--access=public`. |
| 77 | |
| 78 | Management of teams and team memberships is done with the `npm team` command. |
| 79 | |
| 80 | ### Configuration |
| 81 | |
| 82 | #### `json` |
| 83 | |
| 84 | - Default: false |
| 85 | - Type: Boolean |
| 86 | |
| 87 | Whether or not to output JSON data, rather than the normal output. |
| 88 | |
| 89 | - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`. |
| 90 | |
| 91 | Not supported by all npm commands. |
| 92 | |
| 93 | #### `otp` |
| 94 | |
| 95 | - Default: null |
| 96 | - Type: null or String |
| 97 | |
| 98 | This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with `npm access`. |
| 99 | |
| 100 | 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. |
| 101 | |
| 102 | #### `registry` |
| 103 | |
| 104 | - Default: "https://registry.npmjs.org/" |
| 105 | - Type: URL |
| 106 | |
| 107 | The base URL of the npm registry. |
| 108 | |
| 109 | ### See Also |
| 110 | |
| 111 | - [`libnpmaccess`](https://npm.im/libnpmaccess) |
| 112 | - [npm team](/cli/v11/commands/npm-team) |
| 113 | - [npm publish](/cli/v11/commands/npm-publish) |
| 114 | - [npm config](/cli/v11/commands/npm-config) |
| 115 | - [npm registry](/cli/v11/using-npm/registry) |