目录
选择命令行版本:
目录
概要
¥Synopsis
npm owner add <user> <package-spec>npm owner rm <user> <package-spec>npm owner ls <package-spec>alias: author
注意:此命令对工作区无感知。
¥Note: This command is unaware of workspaces.
描述
¥Description
管理已发布包的所有权。
¥Manage ownership of published packages.
-
ls:列出所有有权修改包和推送新版本的用户。当你需要知道向谁寻求帮助时非常方便。
¥ls: List all the users who have access to modify a package and push new versions. Handy when you need to know who to bug for help.
-
add:添加一个新用户作为包的维护者。此用户可以修改元数据、发布新版本和添加其他所有者。
¥add: Add a new user as a maintainer of a package. This user is enabled to modify metadata, publish new versions, and add other owners.
-
rm:从包所有者列表中删除用户。这立即撤销了他们的特权。
¥rm: Remove a user from the package owner list. This immediately revokes their privileges.
请注意,只有一级访问权限。要么你可以修改一个包,要么你不能。未来的版本可能包含更细粒度的访问级别,但目前尚未实现。
¥Note that there is only one level of access. Either you can modify a package, or you can't. Future versions may contain more fine-grained access levels, but that is not implemented at this time.
如果你使用 auth-and-writes
启用了双重身份验证(请参阅 npm-profile
),那么在使用 --otp
更改所有权时,你需要在命令行中包含一个 otp。
¥If you have two-factor authentication enabled with auth-and-writes
(see npm-profile
) then you'll need to include an otp on the command line when changing ownership with --otp
.
配置
¥Configuration
registry
-
默认值:"https://registry.npmjs.org/"
¥Default: "https://registry.npmjs.org/"
-
类型:URL
¥Type: URL
npm 注册表的基本 URL。
¥The base URL of the npm registry.
otp
-
默认值:null
¥Default: null
-
类型:空值或字符串
¥Type: null or String
这是来自双重身份验证器的一次性密码。使用 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.
workspace
-
默认值:
¥Default:
-
类型:字符串(可以设置多次)
¥Type: String (can be set multiple times)
启用在当前项目的已配置工作区的上下文中运行命令,同时通过仅运行此配置选项定义的工作区进行过滤。
¥Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
workspace
配置的有效值为:
¥Valid values for the workspace
config are either:
-
工作区名称
¥Workspace names
-
工作区目录的路径
¥Path to a workspace directory
-
父工作区目录的路径(将导致选择该文件夹中的所有工作区)
¥Path to a parent workspace directory (will result in selecting all workspaces within that folder)
为 npm init
命令设置时,可以将其设置为尚不存在的工作区的文件夹,以创建文件夹并将其设置为项目中的全新工作区。
¥When set for the npm init
command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
此值不会导出到子进程的环境中。
¥This value is not exported to the environment for child processes.
workspaces
-
默认值:null
¥Default: null
-
类型:空值或布尔值
¥Type: null or Boolean
设置为 true 可在所有已配置工作区的上下文中运行该命令。
¥Set to true to run the command in the context of all configured workspaces.
显式将此设置为 false 将导致像 install
这样的命令完全忽略工作区。未明确设置时:
¥Explicitly setting this to false will cause commands like install
to ignore workspaces altogether. When not set explicitly:
-
在
node_modules
树上运行的命令(安装、更新等)会将工作区链接到node_modules
文件夹。* 执行其他操作(测试、执行、发布等)的命令将在根项目上运行,除非在workspace
配置中指定了一个或多个工作区。¥Commands that operate on the
node_modules
tree (install, update, etc.) will link workspaces into thenode_modules
folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, unless one or more workspaces are specified in theworkspace
config.
此值不会导出到子进程的环境中。
¥This value is not exported to the environment for child processes.
也可以看看
¥See Also