简体   繁体   English

全局安装的节点模块

[英]Globally installed node modules

I just had a question.我只是有一个问题。 I kind of know it's silly or the answer is obvious, but I still wanna ask to get it clarified.我知道这很愚蠢或者答案很明显,但我仍然想要求澄清。
Do we need to set the path for globally installed node modules?我们需要为全局安装的节点模块设置路径吗?
I guess, setting the path for the global node modules directory is enough.我想,设置全局节点模块目录的路径就足够了。

No you need not set path for each installed module, you need to only set the path environment variable for the root folder of global npm directory不,你不需要为每个安装的模块设置路径,你只需要为全局 npm 目录的根文件夹设置路径环境变量

Taken from this answer on SO取自关于 SO 的这个答案

On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally.在 Unix 系统上,当全局安装时,它们通常放在 /usr/local/lib/node 或 /usr/local/lib/node_modules 中。 If you set the NODE_PATH environment variable to this path, the modules can be found by node.如果将 NODE_PATH 环境变量设置为该路径,则可以通过节点找到模块。 Windows XP - %USERPROFILE%\\AppData\\npm\\node_modules Windows 7, 8 and 10 - %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules Windows XP - %USERPROFILE%\\AppData\\npm\\node_modules Windows 7、8 和 10 - %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules

I hope this answers your question我希望这回答了你的问题

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

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