npm-prefix

显示前缀

选择命令行版本:

概要

¥Synopsis

npm prefix [-g]

注意:此命令对工作区无感知。

¥Note: This command is unaware of workspaces.

描述

¥Description

将本地前缀打印到标准输出。这是包含 package.json 文件或 node_modules 目录的最近父目录,除非还指定了 -g

¥Print the local prefix to standard output. This is the closest parent directory to contain a package.json file or node_modules directory, unless -g is also specified.

如果指定了 -g,这将是全局前缀的值。有关详细信息,请参见 npm config

¥If -g is specified, this will be the value of the global prefix. See npm config for more detail.

示例

¥Example

npm prefix
/usr/local/projects/foo
npm prefix -g
/usr/local

配置

¥Configuration

global

  • 默认值:false

    ¥Default: false

  • 类型:布尔值

    ¥Type: Boolean

在 "global" 模式下运行,以便将包安装到 prefix 文件夹而不是当前工作目录。有关行为差异的更多信息,请参见 文件夹

¥Operates in "global" mode, so that packages are installed into the prefix folder instead of the current working directory. See folders for more on the differences in behavior.

  • 包安装到 {prefix}/lib/node_modules 文件夹,而不是当前工作目录。

    ¥packages are installed into the {prefix}/lib/node_modules folder, instead of the current working directory.

  • bin 文件链接到 {prefix}/bin

    ¥bin files are linked to {prefix}/bin

  • 手册页链接到 {prefix}/share/man

    ¥man pages are linked to {prefix}/share/man

也可以看看

¥See Also

npm 中文网 - 粤ICP备13048890号