11cb0ef41Sopenharmony_ci---
21cb0ef41Sopenharmony_cititle: npm-access
31cb0ef41Sopenharmony_cisection: 1
41cb0ef41Sopenharmony_cidescription: Set access level on published packages
51cb0ef41Sopenharmony_ci---
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci### Synopsis
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci```bash
101cb0ef41Sopenharmony_cinpm access list packages [<user>|<scope>|<scope:team> [<package>]
111cb0ef41Sopenharmony_cinpm access list collaborators [<package> [<user>]]
121cb0ef41Sopenharmony_cinpm access get status [<package>]
131cb0ef41Sopenharmony_cinpm access set status=public|private [<package>]
141cb0ef41Sopenharmony_cinpm access set mfa=none|publish|automation [<package>]
151cb0ef41Sopenharmony_cinpm access grant <read-only|read-write> <scope:team> [<package>]
161cb0ef41Sopenharmony_cinpm access revoke <scope:team> [<package>]
171cb0ef41Sopenharmony_ci```
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciNote: This command is unaware of workspaces.
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci### Description
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ciUsed to set access controls on private packages.
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciFor all of the subcommands, `npm access` will perform actions on the packages
261cb0ef41Sopenharmony_ciin the current working directory if no package name is passed to the
271cb0ef41Sopenharmony_cisubcommand.
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_ci* public / restricted (deprecated):
301cb0ef41Sopenharmony_ci  Set a package to be either publicly accessible or restricted.
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci* grant / revoke (deprecated):
331cb0ef41Sopenharmony_ci  Add or remove the ability of users and teams to have read-only or read-write
341cb0ef41Sopenharmony_ci  access to a package.
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci* 2fa-required / 2fa-not-required (deprecated):
371cb0ef41Sopenharmony_ci  Configure whether a package requires that anyone publishing it have two-factor
381cb0ef41Sopenharmony_ci  authentication enabled on their account.
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci* ls-packages (deprecated):
411cb0ef41Sopenharmony_ci  Show all of the packages a user or a team is able to access, along with the
421cb0ef41Sopenharmony_ci  access level, except for read-only public packages (it won't print the whole
431cb0ef41Sopenharmony_ci  registry listing)
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ci* ls-collaborators (deprecated):
461cb0ef41Sopenharmony_ci  Show all of the access privileges for a package. Will only show permissions
471cb0ef41Sopenharmony_ci  for packages to which you have at least read access. If `<user>` is passed in,
481cb0ef41Sopenharmony_ci  the list is filtered only to teams _that_ user happens to belong to.
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ci* edit (not implemented)
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci### Details
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ci`npm access` always operates directly on the current registry, configurable
551cb0ef41Sopenharmony_cifrom the command line using `--registry=<registry url>`.
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ciUnscoped packages are *always public*.
581cb0ef41Sopenharmony_ci
591cb0ef41Sopenharmony_ciScoped packages *default to restricted*, but you can either publish them as
601cb0ef41Sopenharmony_cipublic using `npm publish --access=public`, or set their access as public using
611cb0ef41Sopenharmony_ci`npm access public` after the initial publish.
621cb0ef41Sopenharmony_ci
631cb0ef41Sopenharmony_ciYou must have privileges to set the access of a package:
641cb0ef41Sopenharmony_ci
651cb0ef41Sopenharmony_ci* You are an owner of an unscoped or scoped package.
661cb0ef41Sopenharmony_ci* You are a member of the team that owns a scope.
671cb0ef41Sopenharmony_ci* You have been given read-write privileges for a package, either as a member
681cb0ef41Sopenharmony_ci  of a team or directly as an owner.
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ciIf 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
711cb0ef41Sopenharmony_cithe command line.
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ciIf your account is not paid, then attempts to publish scoped packages will
741cb0ef41Sopenharmony_cifail with an HTTP 402 status code (logically enough), unless you use
751cb0ef41Sopenharmony_ci`--access=public`.
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ciManagement of teams and team memberships is done with the `npm team` command.
781cb0ef41Sopenharmony_ci
791cb0ef41Sopenharmony_ci### Configuration
801cb0ef41Sopenharmony_ci
811cb0ef41Sopenharmony_ci#### `json`
821cb0ef41Sopenharmony_ci
831cb0ef41Sopenharmony_ci* Default: false
841cb0ef41Sopenharmony_ci* Type: Boolean
851cb0ef41Sopenharmony_ci
861cb0ef41Sopenharmony_ciWhether or not to output JSON data, rather than the normal output.
871cb0ef41Sopenharmony_ci
881cb0ef41Sopenharmony_ci* In `npm pkg set` it enables parsing set values with JSON.parse() before
891cb0ef41Sopenharmony_ci  saving them to your `package.json`.
901cb0ef41Sopenharmony_ci
911cb0ef41Sopenharmony_ciNot supported by all npm commands.
921cb0ef41Sopenharmony_ci
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ci
951cb0ef41Sopenharmony_ci#### `otp`
961cb0ef41Sopenharmony_ci
971cb0ef41Sopenharmony_ci* Default: null
981cb0ef41Sopenharmony_ci* Type: null or String
991cb0ef41Sopenharmony_ci
1001cb0ef41Sopenharmony_ciThis is a one-time password from a two-factor authenticator. It's needed
1011cb0ef41Sopenharmony_ciwhen publishing or changing package permissions with `npm access`.
1021cb0ef41Sopenharmony_ci
1031cb0ef41Sopenharmony_ciIf not set, and a registry response fails with a challenge for a one-time
1041cb0ef41Sopenharmony_cipassword, npm will prompt on the command line for one.
1051cb0ef41Sopenharmony_ci
1061cb0ef41Sopenharmony_ci
1071cb0ef41Sopenharmony_ci
1081cb0ef41Sopenharmony_ci#### `registry`
1091cb0ef41Sopenharmony_ci
1101cb0ef41Sopenharmony_ci* Default: "https://registry.npmjs.org/"
1111cb0ef41Sopenharmony_ci* Type: URL
1121cb0ef41Sopenharmony_ci
1131cb0ef41Sopenharmony_ciThe base URL of the npm registry.
1141cb0ef41Sopenharmony_ci
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_ci
1171cb0ef41Sopenharmony_ci### See Also
1181cb0ef41Sopenharmony_ci
1191cb0ef41Sopenharmony_ci* [`libnpmaccess`](https://npm.im/libnpmaccess)
1201cb0ef41Sopenharmony_ci* [npm team](/commands/npm-team)
1211cb0ef41Sopenharmony_ci* [npm publish](/commands/npm-publish)
1221cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config)
1231cb0ef41Sopenharmony_ci* [npm registry](/using-npm/registry)
124