1NPM-ACCESS(1) NPM-ACCESS(1)
2
3
4
6 npm-access - Set access level on published packages
7
8 Synopsis
9 npm access public [<package>]
10 npm access restricted [<package>]
11
12 npm access grant <read-only|read-write> <scope:team> [<package>]
13 npm access revoke <scope:team> [<package>]
14
15 npm access 2fa-required [<package>]
16 npm access 2fa-not-required [<package>]
17
18 npm access ls-packages [<user>|<scope>|<scope:team>]
19 npm access ls-collaborators [<package> [<user>]]
20 npm access edit [<package>]
21
22 Description
23 Used to set access controls on private packages.
24
25 For all of the subcommands, npm access will perform actions on the
26 packages in the current working directory if no package name is passed
27 to the subcommand.
28
29 • public / restricted: Set a package to be either publicly accessible
30 or restricted.
31
32 • grant / revoke: Add or remove the ability of users and teams to have
33 read-only or read-write access to a package.
34
35 • 2fa-required / 2fa-not-required: Configure whether a package requires
36 that anyone publishing it have two-factor authentication enabled on
37 their account.
38
39 • ls-packages: Show all of the packages a user or a team is able to ac‐
40 cess, along with the access level, except for read-only public pack‐
41 ages (it won't print the whole registry listing)
42
43 • ls-collaborators: Show all of the access privileges for a package.
44 Will only show permissions for packages to which you have at least
45 read access. If <user> is passed in, the list is filtered only to
46 teams that user happens to belong to.
47
48 • edit: Set the access privileges for a package at once using $EDITOR.
49
50
51 Details
52 npm access always operates directly on the current registry, config‐
53 urable from the command line using --registry=<registry url>.
54
55 Unscoped packages are always public.
56
57 Scoped packages default to restricted, but you can either publish them
58 as public using npm publish --access=public, or set their access as
59 public using npm access public after the initial publish.
60
61 You must have privileges to set the access of a package:
62
63 • You are an owner of an unscoped or scoped package.
64
65 • You are a member of the team that owns a scope.
66
67 • You have been given read-write privileges for a package, either as a
68 member of a team or directly as an owner.
69
70
71 If you have two-factor authentication enabled then you'll be prompted
72 to provide an otp token, or may use the --otp=... option to specify it
73 on the command line.
74
75 If your account is not paid, then attempts to publish scoped packages
76 will fail with an HTTP 402 status code (logically enough), unless you
77 use --access=public.
78
79 Management of teams and team memberships is done with the npm team com‐
80 mand.
81
82 Configuration
83 <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically
84 generated, do not edit manually --> <!-- see lib/utils/config/defini‐
85 tions.js -->
86
87 registry
88 • Default: "https://registry.npmjs.org/"
89
90 • Type: URL
91
92
93 The base URL of the npm registry. <!-- automatically generated, do not
94 edit manually --> <!-- see lib/utils/config/definitions.js -->
95
96
97 otp
98 • Default: null
99
100 • Type: null or String
101
102
103 This is a one-time password from a two-factor authenticator. It's
104 needed when publishing or changing package permissions with npm access.
105
106 If not set, and a registry response fails with a challenge for a
107 one-time password, npm will prompt on the command line for one. <!--
108 automatically generated, do not edit manually --> <!-- see
109 lib/utils/config/definitions.js -->
110
111 <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
112
113
114 See Also
115 • libnpmaccess https://npm.im/libnpmaccess
116
117 • npm help team
118
119 • npm help publish
120
121 • npm help config
122
123 • npm help registry
124
125
126
127
128 October 2021 NPM-ACCESS(1)