简体   繁体   中英

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

Taken from this answer on SO

On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node. Windows XP - %USERPROFILE%\\AppData\\npm\\node_modules Windows 7, 8 and 10 - %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules

I hope this answers your question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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