选择命令行版本:
🌐 Synopsis
npm prefix
注意:此命令不支持工作区。
🌐 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以“全局”模式运行,因此软件包会安装到 prefix 文件夹中,而不是当前工作目录。有关行为差异的更多信息,请参见 folders。
🌐 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 文件夹中,而不是当前工作目录。{prefix}/bin 关联{prefix}/share/man🌐 See Also