简体   繁体   English

用于全局node_modules的package.json

[英]package.json for global node_modules

I am not able to find the package.json for global node modules. 我找不到全局节点模块的package.json。 Where is this global package.json file found? 在哪里找到这个全局package.json文件? If it does not exist, how does node.js keep track of global node modules? 如果不存在,node.js如何跟踪全局节点模块?

There is no global package.json 没有全局package.json

npm doesn't keep track of globals, really. 实际上, npm不会跟踪全局变量。 It just installs them in a common node_modules folder. 它只是将它们安装在公共的node_modules文件夹中。

The binary or command file for the module is symlinked into an executable folder. 模块的二进制或命令文件被符号链接到可执行文件夹中。 for example, on my mac, the symlinks point to /user/local/bin 例如,在我的Mac上,符号链接指向/user/local/bin

To install a global module, use the -g option when installing. 要安装全局模块,请在安装时使用-g选项。

for example : 例如

npm install -g express-generator

This will install the express-generator module into the global npm node_modules folder, and create the needed symlink to execute the express command line tool. 这会将express-generator模块安装到全局npm node_modules文件夹中,并创建所需的符号链接以执行express命令行工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM