选择命令行版本:
See Details
目录
概要
¥Synopsis
npm root
注意:此命令对工作区无感知。
¥Note: This command is unaware of workspaces.
描述
¥Description
将有效的 node_modules
文件夹打印到标准输出。
¥Print the effective node_modules
folder to standard out.
在使用 node_modules
文件夹执行操作的 shell 脚本中使用 npm 很有用。例如:
¥Useful for using npm in shell scripts that do things with the node_modules
folder. For example:
#!/bin/bashglobal_node_modules="$(npm root --global)"echo "Global packages installed in: ${global_node_modules}"
配置
¥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