选择命令行版本:
🌐 Synopsis
npm access list packages [<user>|<scope>|<scope:team>] [<package>]npm access list collaborators [<package> [<user>]]npm access get status [<package>]npm access set status=public|private [<package>]npm access set mfa=none|publish|automation [<package>]npm access grant <read-only|read-write> <scope:team> [<package>]npm access revoke <scope:team> [<package>]
注意:此命令不支持工作区。
🌐 Note: This command is unaware of workspaces.
🌐 Description
用于设置私有包的访问控制。
🌐 Used to set access controls on private packages.
对于所有子命令,如果子命令未传入任何包名,npm access 将对当前工作目录中的包执行操作。
🌐 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.
🌐 Details
npm access 总是直接操作当前注册表,可以通过命令行使用 --registry=<registry url> 配置。
未加作用域的包_总是公开的_。
🌐 Unscoped packages are always public.
作用域包默认是受限的,但你可以使用 npm publish --access=public 将它们发布为公开,或者在首次发布后使用 npm access set status=public 将其访问权限设置为公开。
🌐 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.
你必须具有设置包访问权限的权限:
🌐 You must have privileges to set the access of a package:
如果你启用了双因素认证,那么系统将提示你提供第二个验证码,或者可以使用 --otp=... 选项在命令行上指定它。
🌐 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.
如果你的账户未付款,尝试发布限定范围的包将会失败,并返回 HTTP 402 状态码(逻辑上合理),除非你使用 --access=public。
🌐 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.
团队及团队成员的管理使用 npm team 命令进行。
🌐 Management of teams and team memberships is done with the npm team command.
🌐 Configuration
json是否输出 JSON 数据,而不是正常输出。
🌐 Whether or not to output JSON data, rather than the normal output.
npm pkg set 中,它可以在将值保存到你的 package.json 之前使用 JSON.parse() 解析设置的值。并非所有 npm 命令都支持。
🌐 Not supported by all npm commands.
otp这是来自双因素认证器的一次性密码。在使用 npm access 发布或更改软件包权限时需要此密码。
🌐 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with npm access.
如果未设置,并且注册表响应失败并询问一次性密码,npm 将在命令行上提示输入一次密码。
🌐 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.
registrynpm 注册表的基本 URL。
🌐 The base URL of the npm registry.
🌐 See Also