What is global-modules?
The global-modules npm package provides the location of the globally installed npm packages on the user's system. It is a simple utility that can be used to find out where global npm packages are stored, which can vary depending on the operating system and the configuration of the npm environment.
What are global-modules's main functionalities?
Get the path to global node_modules
This feature allows you to retrieve the path to the directory where global npm packages are installed. The code sample shows how to import the global-modules package and log the path to the console.
const globalModules = require('global-modules');
console.log(globalModules);
Other packages similar to global-modules
global-prefix
The global-prefix package is similar to global-modules in that it provides the location of the global npm prefix, which is the directory where global packages are installed. However, global-prefix focuses on the prefix path itself rather than the node_modules directory.
global-npm
The global-npm package can locate the npm binary that is installed globally on the system. While it serves a different purpose than global-modules, it is related in the sense that it deals with global npm installations.
which-pm-runs
The which-pm-runs package is used to detect which package manager is currently running the script. It is not directly related to finding the location of global modules, but it is useful in a global npm context to understand which package manager is in use.
global-modules
The directory used by npm for globally installed npm modules.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install
Install with npm:
$ npm install --save global-modules
Usage
const globalModules = require('global-modules');
console.log(globalModules);
(Note that this path might be different based on platform, user-defined configuration settings, etc)
About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb
Related projects
You might also be interested in these projects:
Contributors
Author
Jon Schlinkert
License
Copyright © 2018, Jon Schlinkert.
Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on December 14, 2018.